answer ratio for the last M months

2

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

Вопросы и ответы для программистов

declare @months_ago DATETIME = DateAdd(month, -##months:int##, GETUTCDATE())

-- 1 - question
-- 2 - answer
select cast((select count(*) from Posts where PostTypeId = 2 and CreationDate > @months_ago) as float) / (select count(*) from Posts where PostTypeId = 1  and CreationDate > @months_ago) as [answer ratio]

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results