你的位置:首页 > 数据库

[数据库]Oracle、MySql、SQLServer数据分页查询


看过此博文后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 rrWHERE 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三种数据库的分页查询的实例