with qa as ( SELECT count(OwnerUserId) as active, p.Owner...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

with qa as (
  SELECT
  count(OwnerUserId) as active,
  p.OwnerUserId,
  DATENAME(Month, p.CreationDate) AS Month,
  DATENAME(Year, p.CreationDate) AS Year,
  SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) As Answer,
  SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) As Question,
  SUM(p.ViewCount) as ViewCount,
  SUM(p.CommentCount) as ReceivedComments, 
  SUM(p.AnswerCount) as AnswerCountReceived
  FROM Posts as p
  WHERE p.PostTypeId In (1,2) AND DATENAME(Year, p.CreationDate) >= 2010 AND DATENAME(Year, p.CreationDate) <= 2020 AND p.OwnerUserId in ('27905','263693','113848','2766176','246568','198536','284240','165071','584518','145346','70942','383904','341994','188331','88656','253056','576911','17300','522663','14768','283366','5295','589924','82294','149436')
  GROUP BY p.OwnerUserId, DATENAME(Year, p.CreationDate), DATENAME(Month, p.CreationDate)
)
SELECT 
    u.Id as UserId,
    p.active,
    p.Year,
    p.Month,
    p.Answer,
    p.Question,
    p.ViewCount,
    p.ReceivedComments,
    p.AnswerCountReceived,
    datediff(MONTH,u.CreationDate,GETDATE()) as Tenure
FROM Users as u
inner join qa as p on u.Id = p.OwnerUserId
WHERE u.Id > 0
ORDER BY u.Id, p.Year

Enter Parameters

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