ปิดและเปิดโหวตใหม่ทุกสัปดาห์ ไม่จำเป็นต้องใช้ตารางทั้งหมด
Close and reopen votes by week.It is not neccessary to use all the tables.
 PostTypes:  Id [ number]  Name [ text] 
SELECT DATEADD(week, DATEDIFF(week, @start, CreationDate), @start) AS "week", SUM(CASE WHEN PostHistoryTypeId = 10 THEN 1 ELSE 0 END) AS "closevotes", SUM(CASE WHEN PostHistoryTypeId = 11 THEN 1 ELSE 0 END) AS "reopenvotes" FROM PostHistory WHERE PostHistoryTypeId IN (10, 11) AND CreationDate >= @start AND CreationDate < @stop GROUP BY DATEADD(week, DATEDIFF(week, @start, CreationDate), @start) ORDER BY DATEADD(week, DATEDIFF(week, @start, CreationDate), @start)