sql统计不重复条数

2025-03-23 20:35:15
推荐回答(1个)
回答1:

select count(*)
from
(
select 字段
from 表
group by 字段
having count(字段)<=1
order by 字段
)
结果应该和
select count(1) from(select distinct 字段 from 表)一样
这种方法才是对的