Who's asking/answering the most questions on U.S. holidays?! (And why? ... just kidding, we know why...)
Q&A about the Stack Exchange Network
-- Holiday Work Horse
-- Who's asking/answering the most questions on U.S. holidays?! (And why? ... just kidding, we know why...)
DECLARE @year int = ##Year##
@year as 'Year'
,u.DisplayName as 'User Name'
,count(p.Id) as 'Number of Questions/Answers'
,(u.Reputation/(count(p.Id))) as 'Reputation'
INNER JOIN posts p on p.OwnerUserId = u.id
AND (p.PostTypeId IN (1,2)) /* Questions and Answers */
AND p.OwnerUserId IS NOT NULL /* Registered Users */
AND u.Reputation > 250 /* Reputation min. */
-- AND u.DisplayName = 'iight' /* not me... */
AND year(p.CreationDate) = @year /* Year input */
(Month(p.CreationDate) = 12 AND Day(p.CreationDate) = 25) /* Xmas */
(Month(p.CreationDate) = 7 AND Day(p.CreationDate) = 4) /* July 4 */
/* add a different 'holy-day' here ... maybe Jan 1 ? */
HAVING count(p.Id)> 0 /* Prevent negative denominators */
'Number of Questions/Answers' DESC /* Show the most active on top */