Table :tbl_user
dateofregistration ID registrationstate
6-03-11 3 0
6-03-11 1 0
6-03-11 2 1
7-03-11 2 1
7-03-11 1 1
我怎麼能顯示導致這樣的SQL Server 2008 Express的如何查詢同一個表的兩個列有兩個條件與GROUPBY
date TotalID(count) Total State(0 only)
6-03-11 3 2
7-03-11 2 0
我試圖與這
SELECT CONVERT(varchar(10), dateofregistration, 103) AS Date,
(select COUNT(ID)) AS Subbase,
(Select Count(ID)from tbl_User where (registrationstate='0')) AS Totalchurn
FROM tbl_User
GROUP BY CONVERT(varchar(10), dateofregistration, 103);
但錯誤的結果。任何幫助PLZ。
所以**你得到什麼**?!?!?? – 2011-04-16 14:26:07