首页 > 代码库 > 分组排序SQL

分组排序SQL

SELECT * FROM (SELECT columns,ROWNUM AS RN FROM (SELECT DISTINCT columns FROM table WHERE 1=1)) T WHERE RN = ‘1‘SELECT * from (SELECT columns,(ROW_NUMBER() OVER (ORDER BY column DESC)) RNFROM (SELECT DISTINCT columns FROM table) t1) t2WHERE t2.RN>1 AND t2.RN<5

 

分组排序SQL