sql从查询结果中选择中间某部分记录假如我查到了1000条记录,我想取其中的第200~300条记录
sqlserver:
with t as ( select top 300 row_number() over(order by 字段) r, * from 表)
select * from t where r>=200
oracle:
sql包含哪几个部分with t as ( select rownum r, * from 表 where rownum<=300 )
select * from t where r>=200
mysql:
select * from 表 limit 199,100
db2:
with t as ( select row_number() over(order by 字段) r, * from 表 fetch frist 300 rows only)
select * from t where r>=200
其中 sqlserver\oracle\db2也可直接
with t as (select row_number() over(order by 字段) r, * from 表)
select * from t where r between 200 and 300
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论