Q&A for active researchers, academics and students of physics
--accepted answer select OwnerUserId as [User Link], count(1) shots from ( select b.OwnerUserId, row_number() over (partition by a.Id order by b.CreationDate) as r from Posts a inner join Posts b on a.PostTypeId = 1 and b.PostTypeId = 2 and b.ParentId = a.Id and a.CreationDate > '2013-09-22' and DATEDIFF(mi,a.CreationDate,b.CreationDate) < ##MaxDuration## ) as FG where r = 1 group by OwnerUserId having count(1) > 25 order by shots desc; /*select a.OwnerUserId, count(1) from Posts a where a.PostTypeId = 2 and a.CreationDate > '2013-09-21' and exists (select 1 from Posts b where b.Id = a.ParentId and DATEDIFF(mi,b.CreationDate,a.CreationDate) < ##MaxDuration## ) and not exists (select 1 from Posts c where c.ParentId = a.ParentId and c.CreationDate > a.CreationDate ) group by a.OwnerUserId order by 2 desc*/