sql 返回从第几行到第几行

上一篇 / 下一篇  2017-08-10 16:02:30 / 个人分类:数据库

mysql 用limit
select * from user limit 1,4, 返回从第二行到第五行

limit,可以接受一个参数或者两个,一个是偏移量,第二最大的个数,默认的便宜量是0
limit 5,是返回 前五行


oracle
select * from css_bl_view a
    where capture_phone_num = '(1) 925-4604800'
    and rownum <= 10
    minus
    select * from css_bl_view a
    where capture_phone_num = '(1) 925-4604800'
    and rownum <= 5
   ;
minus 是使用


sql> select * from
  2  (
  3  select a.*, rownum as rn from css_bl_view a
  4  where capture_phone_num = '(1) 925-4604800'
  5  ) b
  6  where b.rn between 6 and 10;

TAG:

 

评分:0

我来说两句

Open Toolbar