asp中如何用sql提取表中不重复项的个数?

来源:百度知道 编辑:UC知道 时间:2024/05/21 23:50:13
asp中如何用sql提取表中不重复项的个数?
sql="select ??? as total from 表名"
这条要怎么写?
select count(distinct User_ID) as total from xyqj_log
提示:语法错误 (操作符丢失) 在查询表达式 'count(distinct User_ID)' 中。

sql="select Count(Distinct 列名) as total from 表名"
是不是这个?

补充,你把User_id加上[]试试
select count(distinct [User_ID]) as total from xyqj_log

语法应该没有什么问题,刚刚在数据库测试过

select sum(cnt) as cnt
from (select ?,?,?, count(*) as cnt
from 表名
group by ?,?,?
having count(*) = 1 )

sql="select distinct item3333 as total from 表名"