日期:2014-05-19  浏览次数:20756 次

越简单越好!简单的统计
表格如下:
id   num
11     12
12     12
13     13
14     88
15   10
..     ..

num有可能重复。

求:num最小(大)的id数目
2/1


------解决方案--------------------
--try
select count(*) from table a where a.num=(select min(num) from table )
group by num

------解决方案--------------------
select count(*) 'num最小的id數目 ' from 表
where id =(select min(num) from 表)

暫時只想到上面的蠢方法

------解决方案--------------------
select count(*) from tablename where num in (select min(num) as num from tablename )

------解决方案--------------------
select count(1) from table a where exists(select 1 from table where num> a.num) group by a.num
------解决方案--------------------
呵呵。。都是正解
------解决方案--------------------
select top 1 * from table order by num asc(/desc) --