首页 > 数据库技术 > 详细

Oracle、MySql、SQLServer数据分页查询

时间:2015-04-20 16:48:25      阅读:216      评论:0      收藏:0      [点我收藏+]

看过此博文后Oracle、MySql、SQLServer 数据分页查询,在根据公司的RegionRes表格做出了

SQLserver的分页查询语句:

SELECT DISTINCT TOP 500 
    rr.ID AS id 
    ,rr.strName AS name 
    ,rr.nType AS res_type 
    ,rr.nRegID AS region_id 
    ,rr.strChanName AS channel_name 
    ,rr.nChanNum AS channel 
    ,rr.nSortID AS sort_id 
    ,rr.nCamType AS camera_type 
    ,rr.nKBCtrlNo AS kb_ctrl_num 
    ,rr.nPbType AS playback_type 
    ,rr.nDevID AS device_id 
    ,rr.nProt AS protocol 
    ,rr.nStreamValue AS stream_value 
    ,rr.nStreamType AS stream_type 
    ,rr.nBeInspect AS is_inspect 
    ,rr.nMultID AS mult_id 
    ,rr.nMultVer AS mult_ver 
    ,rr.nMultSysID AS mult_sys_id 
    ,rr.strInterAreaCode AS index_code 
    ,pass AS device_index_code 
FROM(
    SELECT row_number() OVER (ORDER BY oo.ID ASC) AS rownumber, 
    * FROM(SELECT DISTINCT * FROM RegionRes o WHERE o.nType = 0 ) AS oo
) AS rr
WHERE rownumber > 10;

MySQL的分页查询语句:

SELECT DISTINCT
    rr.ID AS id 
    ,rr.strName AS name 
    ,rr.nType AS res_type 
    ,rr.nRegID AS region_id 
    ,rr.strChanName AS channel_name 
    ,rr.nChanNum AS channel 
    ,rr.nSortID AS sort_id 
    ,rr.nCamType AS camera_type 
    ,rr.nKBCtrlNo AS kb_ctrl_num 
    ,rr.nPbType AS playback_type 
    ,rr.nDevID AS device_id 
    ,rr.nProt AS protocol 
    ,rr.nStreamValue AS stream_value 
    ,rr.nStreamType AS stream_type 
    ,rr.nBeInspect AS is_inspect 
    ,rr.nMultID AS mult_id 
    ,rr.nMultVer AS mult_ver 
    ,rr.nMultSysID AS mult_sys_id 
    ,rr.strInterAreaCode AS index_code 
    ,pass AS device_index_code 
FROM RegionRes rr 
WHERE rr.nType = 0 ORDER BY rr.ID ASC LIMIT 10,500


其他网站:

oracle,mysql,SqlServer三种数据库的分页查询的实例

 

Oracle、MySql、SQLServer数据分页查询

原文:http://www.cnblogs.com/xuejianhui/p/4441676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!