Q&A about the site for linguists, teachers and students of the Ukrainian language
with a as ( select pa.Score, pq.CreationDate as question_date, pa.CreationDate as answer_date, DATEDIFF(hh, pq.CreationDate, pa.CreationDate) daydiff from Posts pa join Posts pq on pa.ParentId = pq.Id ) select daydiff, sum(1.00*Score) weight, avg(1.00*Score) quality from a where daydiff >=0 group by daydiff order by daydiff