select OwnerUserId, count(year) as active_year, sum(activ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

select 
OwnerUserId,
count(year) as active_year,
sum(active_month) as sum_month
from
 ( 
 select distinct
  p.OwnerUserId,
  count(DISTINCT MONTH(p.creationdate)) as active_month,
  YEAR(p.creationdate) as Year
  from posts p 
  where p.OwnerUserId = 5295 AND YEAR(p.creationdate) >= 2010 AND YEAR(p.creationdate) <= 2020
  group by p.OwnerUserId, YEAR(p.creationdate)
 ) as dt
 group by OwnerUserId, year

Enter Parameters

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