Q&A about the site for those who base their lives on Jewish law and tradition and anyone interested in learning more
declare @median int; -- clasic median SELECT @median = MAX(Score) FROM (SELECT TOP 50 percent Score FROM Posts as PU WHERE PostTypeId = 1 and CommunityOwnedDate IS NULL and ( Tags like '%##tagName##%' OR Tags like '##tagName##%' OR Tags like '%##tagName##%' ) ORDER BY Score ) as t; -- report results SELECT Count(Posts.Id) AS Qns, @median as MedianAnswerScore, avg(Score) as AverageScore FROM Posts WHERE PostTypeId = 1 and CommunityOwnedDate IS NULL and ( Tags like '%##tagName##%' OR Tags like '##tagName##%' OR Tags like '%##tagName##%' ) -- select @median2_below50, @median2_total ;