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

Oracle、MySql、SQLServer数据分页查询

时间:2015-04-20 16:50:09      阅读:150      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!