select identity(int,1,1) as xh,* into #a from tb
delete #a from #a a,
(select xh,max(a) as a from #a) b
where a.xh=b.xhselect max(a) from #a
delete #a from #a a,
(select xh,max(a) as a from #a) b
where a.xh=b.xhselect max(a) from #a
(select top 2 * from table
order by ID desc) as a
order by a.ID
where(select count(*) from 表 where a>=a.a)=2 --第二大
select a from 表 a
where(select count(*) from 表 where a>=a.a)=3 --第三大select a from 表 a
where(select count(*) from 表 where a>=a.a)=n --第N大
(第n大的)
where(select count(Distinct a) from 表 where a>=a.a)=n --第N大不過卻很慢
不知可以怎樣優化?
老冯写的已经DISTINCT了。
真羡慕你,有100多万条数据可用,呵呵
真羡慕你,有100多万条数据可用,呵呵