Oracle General pagination is written as
Select A.id,a.title,rownum as Rn,a.create_time from (select A.* to temp a order by create_time Desc) A Where rownum<=20
Note: I'm using create_time to sort the create_time with equal
In order to vary the score page data I use the LEFT join to see if the data is normal
This is a page I used to correlate the difference between a score of 20 data and 10 of the data
Select A.title,a.rn,b.title,b.rn from (select A.id,a.title,rownum as Rn,a.create_time from ( Select A.* from Temp a order by create_time Desc) a where rownum<=20) a LEFT join (select A.id,a.title,row Num as Rn,a.create_time from (select A.* from temp a order by create_time Desc) a where rownum<=10) B on A.id=b.id
Execution results
According to the truth, the right front 10 will be the same as the left Front 10 data, but after the operation is not the same
as If that happens, there may be a record in the paging clock that appears on multiple pages or even multiple page data
SQL adjusted in a nested layer
Select A.* from (select A.id,a.title,rownum as Rn,a.create_time from (select A.* from Temp a ORDER BY create_time Desc) a) a where a.rn<=20
select a.title,a.rn,b.title,b.rn from (select a.* from (Select a.id,a.title,rownum as rn, a.create_time from (select a.* from temp a order by create _TIME&NBSP;DESC) a) a where a.rn<=20) a left join (select a.* from (select a.id,a.title,rownum as rn,a.create_time from (select a.* &NBSP;FROM&NBSP;TEMP&NBSP;A&NBSP;ORDER&NBSP;BY&NBSP;CREATE_TIME&NBSP;DESC) a) a where a.rn<=10) b on a.id=b.id
Comparison of execution results
So the result is right.
There is no discovery although the same sq set up a layer of select after the result set is changed before and after two pictures of the left column results are not the same
Summarize the time I use here to sort a lot of data with equal time if the sort field alone should not have this problem appearing
Incorrect data duplication for Oracle paging data