越简单越好!简单的统计
表格如下:
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) --