declare @posts table ( CreationYear int, Posts bigint ) ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

declare @posts table (
   CreationYear int,
   Posts bigint
)

insert into @posts ( CreationYear, Posts )
  select year(P.CreationDate) as CreationYear, count(*) 
  from Posts as P 
  group by year(P.CreationDate)
  
select 
year(V.CreationDate) as [Year],
count(V.Id),
(select Posts from @posts as P where P.CreationYear = year(V.CreationDate))
from 
Votes as V
where
V.VoteTypeId in (12)
group by
year(V.CreationDate)
order by
[Year]
asc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results