比如
Col1,Col2,Col3,Col4.Col5,.........项目很多按照Col1,Col2,Col3 分组后,做多只要10条,该怎么写好?
Select * 
From Tb
Group By Col1,Col2,Col3

解决方案 »

  1.   

    Select top 10 * 
    From Tb
    Group By Col1,Col2,Col3
      

  2.   

    如果id唯一
    select * from tb a where id in(select id from tb where a.col1=col1 and a.col2=col2 and a.col3=col3 group by col1,col2,col3)
      

  3.   

    select * from tb a where id in(select top 10 id from tb where a.col1=col1 and a.col2=col2 and a.col3=col3 group by col1,col2,col3)
      

  4.   

    --orselect * from tb a where 10>(select count(1) from tb where a.col1=col1 and a.col2=col2 and a.col3=col3 and id<a.id group by col1,col2,col3)
      

  5.   

    ==================================
    =  CSDN助手 全面支持CSDN论坛     =
    =  监视、收藏、历史、签名走马灯  =
    ==================================