Q&A for professional and enthusiast programmers
declare @monthAgo date = dateadd(month, -1, getdate()); select cast(CreationDate as date) as Created, count(Id) as Posted, sum(AnswerCount) as Answers, sum(AnswerCount) + (count(Id) - sum(AnswerCount)) / 2 as Median from posts where (1=1) and PostTypeId = 1 and cast(CreationDate as date) >= @monthAgo and cast(CreationDate as date) < cast(getdate() as date) group by cast(CreationDate as date) order by Created asc