select identity(int,1,1) as id,* into #t from testselect top 10 a.a,a.b,a.c from #t a join ( select min(id) as nid from #t group by a ) b on a.id=b.nid drop table #t
select top 4 a from (select distinct a from 表) a
select top 10 a,max(b) as b,max(c) as c from test group by a
请教txlicenhe(马可) 和LoveSQL(ligg) :你们给出的方法可以通过 问题1:我还想ORDER BY C DESC 怎么处理呢,如果直接加上去是不行的 问题2:你们用的MIN,和MAX在这里是什么用的,和我解释下好么谢谢
from #t a join
( select min(id) as nid
from #t
group by a
) b on a.id=b.nid drop table #t
问题1:我还想ORDER BY C DESC 怎么处理呢,如果直接加上去是不行的
问题2:你们用的MIN,和MAX在这里是什么用的,和我解释下好么谢谢