SQL CE DISTINCT AGGREGATE
问题 Does SQL CE has the ability to use distinct in aggregate functions? I need something like SELECT count(distinct date) FROM table This is simplified query and I already have GROUP BY used in original one. 回答1: SQL Server CE (current version) does not support count(distinct) The workaround is a GROUP BY, which sounds like what you are using select count(*) from ( select distinct date from tbl ) x Or if other fields are involved select groupcol, count(*) from ( select groupcol, date from tbl