总结了一下几种方法 具体在MSSQL SYBASE下面用top 来分页 POSTGRESQL MYSQL就直接用limit更简单了

在oracle 下面想了4总方法

minus差分页 select * from table where rownum<=10 minus select * from table where rownum<=5

rownum伪列select * from (select rownum tid,t.* from table t where rownum<=10) where tid<=10 and tid>=5

notin相反select * from table where id not in(select id from table where rownum<=5) and rownum<=5

前题是id排序的select * from table where id>(select max(id) from table where rownum<=5) and rownum<=5

要是有更好的方法 还望多多指教

相关文章:

  • 2022-02-06
  • 2022-01-17
  • 2022-12-23
  • 2021-12-28
  • 2021-12-18
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-12-19
  • 2022-03-03
相关资源
相似解决方案