SQL CE DISTINCT集合 [英] SQL CE DISTINCT AGGREGATE

查看:103
本文介绍了SQL CE DISTINCT集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL CE是否具有使用聚合函数中不同的功能?
我需要类似

Does SQL CE has the ability to use distinct in aggregate functions? I need something like

SELECT count(distinct date) FROM table

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

This is simplified query and I already have GROUP BY used in original one.

推荐答案

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

SQL Server CE (current version) does not support count(distinct)

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

The workaround is a GROUP BY, which sounds like what you are using

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 CE DISTINCT集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆