jhanlon homework W7Q3

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

-- Questions from users signed up in 2012 
-- with Rows Indicating Post number per user
WITH Row2012 AS (
  SELECT Row_Number() OVER (Partition by p.OwnerUserId Order By p.Id asc) Row, u.Id userid, p.Id post, p.ClosedDate
  FROM Posts p
  JOIN Users u ON u.Id = p.OwnerUserId
  WHERE PostTypeId=1 AND DATEPART(YEAR, u.CreationDate)='2012'
  )
  
SELECT Top 1000 userid, MAX(Row) questions
FROM Row2012
WHERE Row <11
GROUP BY UserId
ORDER BY UserId

Enter Parameters

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