1.查询T表的字段a,字段b,字段c ;
根据字段b分组,字段b排序,字段c等于24,每组的前三条数据
select * from (select a,b,c,row_number() over(partition by b order by b desc) e from T where c=24) where e<4
2.根据usertype分组,将每组的name合并到一行显示
select wm_concat(name),usertype from TableName where rownum<4 group by usertype
原图:
效果图: