参见:
http://community.csdn.net/Expert/topic/3602/3602230.xml?temp=.7934229

解决方案 »

  1.   

    select id=identity(int,1,1),* into #t from pf_ckmx order by 单位select * 
    from #t a
    where (select count(*) from #t where 单位=a.单位 and id<=a.id)<=10
      

  2.   

    select * from pf_ckmx a
    where ID in(select top 10 ID from pf_ckmx where 单位=a.单位)
      

  3.   

    经论证yesyesyes() 是对的!呵呵!
      

  4.   

    declare @str nvarchar(4000)
    set @str=''
    select @str=@str+'select top 10 * from pf_ckmx where unit=''' +unit + ''' union all ' from pf_ckmx group by unit
    select @str=left(@str,len(@str)-10)
    exec(@str)