SQL CE DISTINCT集合

Bla*_*ter 1 sql aggregate distinct

SQL CE是否有能力使用不同的聚合函数?我需要类似的东西

SELECT count(distinct date) FROM table
Run Code Online (Sandbox Code Playgroud)

这是简化的查询,我已经在原始查询中使用了GROUP BY。

Ric*_*iwi 5

SQL Server CE(当前版本)不支持count(distinct)

解决方法是GROUP BY,听起来像您正在使用的是

select count(*) from (
    select distinct date from tbl
) x
Run Code Online (Sandbox Code Playgroud)

或者如果涉及其他领域

select groupcol, count(*)
from (
    select groupcol, date
    from tbl
    group by groupcol, date
) x
group by groupcol
Run Code Online (Sandbox Code Playgroud)