new

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow em Português

Perguntas e respostas para programadores profissionais e entusiastas

select p.Id,count(vp.PostId) as fav_total
from Posts p 
left outer join 
(select pp.ParentId,min(pp.CreationDate) as maxcdate
from Posts pp
where pp.PostTypeId=2 
group by pp.ParentId)pa on p.Id=pa.ParentId
left outer join 
(select v.PostId,v.CreationDate 
from Votes v
where v.VoteTypeId=5)vp on p.Id=vp.PostId
where p.PostTypeId=1
and p.Id%500=358
and Year(p.CreationDate)=2019
and vp.CreationDate<maxcdate
group by p.Id

Enter Parameters

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