Q&A for active researchers, academics and students of physics
--accepted answer select a.*,b.*, 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 DATEDIFF(mi,a.CreationDate,b.CreationDate) < ##MaxDuration## order by a.Id