create table #tmp_dates (date datetime) insert into #tmp_...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Role-playing Games

Q&A for gamemasters and players of tabletop, paper-and-pencil role-playing games

create table #tmp_dates (date datetime)
insert into #tmp_dates values ('20090801')
insert into #tmp_dates values ('20090901')
insert into #tmp_dates values ('20091001')

SELECT date, 
       (SELECT Count(*) FROM Posts
           WHERE PostTypeId = 1 
           AND ClosedDate is null
           AND CreationDate < date
       ) AS total_questions,
       (SELECT COUNT(*) FROM posts AS q
            WHERE PostTypeId=1
            AND ClosedDate is null
            AND CreationDate < date
            AND (AcceptedAnswerId <> ''
                 OR
                 (SELECT COUNT(*) FROM posts AS a WHERE PostTypeId=2 AND ParentId=q.id AND Score>0) > 1)
       ) AS answered_questions
FROM #tmp_dates

Enter Parameters

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