> 文章列表 > select distinct count(*) from

select distinct count(*) from

select distinct count(*) from

关于select distinct count(*) from这个很多人还不知道,今天小六来为大家解答以上的问题,现在让我们一起来看看吧!

1、直接查询似乎没有方法 WHITE_WIN的方法是不行的 比如表中包含 1 2 1 2 2 1 3 1 1 他的查询结果是 3,2,1 可以看出实际表中没有这样的行 nomanland的方法在a列没有重复值的情况下可行。

2、如果有重复值就会出现重复结果 如果允许的话要使用临时表 select a,b,c,identity(int,1,1) as id into # from 表 select a,b,c from # where id in(select max(id) from # group by c) drop table #。

本文到此分享完毕,希望对大家有所帮助。