SQL CE独立聚合

SQL CE独立聚合,sql,aggregate,distinct,Sql,Aggregate,Distinct,SQL CE是否能够在聚合函数中使用distinct? 我需要像这样的东西 SELECT count(distinct date) FROM table 这是一个简化的查询,我已经在原始查询中使用了GROUP BY。SQL Server CE(当前版本)不支持计数(不同) 解决方法是一种分组方式,听起来像您正在使用的 select count(*) from ( select distinct date from tbl ) x 或者如果涉及其他领域 select groupcol,

SQL CE是否能够在聚合函数中使用distinct? 我需要像这样的东西

SELECT count(distinct date) FROM table
这是一个简化的查询,我已经在原始查询中使用了GROUP BY。

SQL Server CE(当前版本)不支持计数(不同)

解决方法是一种分组方式,听起来像您正在使用的

select count(*) from (
    select distinct date from tbl
) x
或者如果涉及其他领域

select groupcol, count(*)
from (
    select groupcol, date
    from tbl
    group by groupcol, date
) x
group by groupcol
SQL Server CE(当前版本)不支持计数(不同)

解决方法是一种分组方式,听起来像您正在使用的

select count(*) from (
    select distinct date from tbl
) x
或者如果涉及其他领域

select groupcol, count(*)
from (
    select groupcol, date
    from tbl
    group by groupcol, date
) x
group by groupcol