Q&A about the site for Joomla! administrators, users, developers and designers
CREATE Table #DelTab (AADelay_mi int, QScore int, AScore int, dummi int); go CREATE Table #LongTab (Repu int, Longe_d int, dummi int); go Insert into #DelTab (AADelay_mi, QScore, AScore, dummi) select datediff (mi, p1.CreationDate, p2.CreationDate), p1.Score, p2.Score, 1 from Posts p1, Posts p2 where p1.PostTypeId = 1 and p2.PostTypeId = 2 and p1.AcceptedAnswerId = p2.Id and p2.ParentId = p1.Id go select * from #DelTab order by AADelay_mi select PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY AADelay_mi) OVER(PARTITION BY dummi) from #DelTab Insert into #LongTab (Repu, Longe_d, dummi) select Reputation, datediff (day, u.CreationDate, u.LastAccessDate), 1 from Users u go select * from #LongTab order by Longe_d select Longe_d, count (*) K from #LongTab group by Longe_d order by Longe_d select PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY Longe_d) OVER(PARTITION BY dummi) from #LongTab