码迷,mamicode.com
首页 > 数据库 > 详细

分组排序SQL

时间:2015-01-18 22:31:48      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

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)) RN
FROM (SELECT DISTINCT columns FROM table) t1) t2
WHERE t2.RN>1 AND t2.RN<5

 

分组排序SQL

标签:

原文地址:http://www.cnblogs.com/myblogslh/p/4232373.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!