/*SELECT Users.Id AS Id, COUNT(Posts.Id) AS NumPosts INTO...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Korean Language

Q&A for linguists, teachers and students of the Korean language

/*SELECT Users.Id AS Id, COUNT(Posts.Id) AS NumPosts
INTO PostsByUser
FROM Users
  LEFT JOIN Posts
  ON Users.Id = Posts.OwnerUserId
  GROUP BY Users.Id;
 
 
SELECT Id, NumPosts

FROM Users
  LEFT JOIN Posts
  ON Users.Id = Posts.OwnerUserId
  GROUP BY Users.Id*/



  SELECT Users.Id AS Id, COUNT(Posts.Id) AS NumPosts,
  CASE WHEN COUNT(Posts.Id) > 10 THEN '>10'
  WHEN COUNT (Posts.Id) BETWEEN 1 AND 10 THEN '1-10'
  ELSE '0' END
  AS Classification
FROM Users
 LEFT JOIN Posts
 ON Users.Id = Posts.OwnerUserId
 GROUP BY Users.Id
 ORDER BY Classification DESC;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results