1
SELECT Count (*) AS Amount FROM Tbl_Original WHERE AcctNumber IS NOT NULL AND dateadded between '20151001' AND '20151031'
UNION
SELECT Count (*) FROM Tbl_Original WHERE AcctNumber IS NOT NULL AND dateadded between '20151101' AND '20151130'
UNION
SELECT Count (*) FROM Tbl_Original WHERE AcctNumber IS NOT NULL AND dateadded between '20151201' AND '20151231'`
Tbl_OriginalSQL代碼按日期
AcctNu Dateadded
-----------------------
qwe56755 10/22/2015
qwe33455 10/06/2015
qwe09967 11/17/2015
試圖讓這個:
Month Amount
-------------------
October 2
November 1
使用此SQL(在Access)。
謝謝安德烈!這工作得很好 – onemoremile
試圖做交叉表(我想,但我可能是錯的)的問題是我正在使用繼承的數據庫。有一些非常糟糕的桌子設計,我必須解決。例如,「dateadded」字段被編碼爲「文本」而不是「日期」,並且當然它被鏈接到其他表和查詢。所以我爲給定的範圍分配了幾個月,然後以某種方式顯示數據。再次感謝 – onemoremile
@onemoremile:如果答案解決了您的問題,您可以[接受它](http://stackoverflow.com/help/someone-answers),這也標誌着問題已解決。 – Andre