首页 > 代码库 > SQL分页4

SQL分页4

1.根据ROWID来分,个人喜欢这种,换下函数名称后可用于MSSQL与ORACLE


select * from TABLE1 where rowid in

(

  select rid from

    (

      select rownum rn,rid from

        (

          select rowid rid,cid from TABLE1 order by cid desc

        )

      where rownum<10000

    )

  where rn>9980)

order by cid desc;

SQL分页4