In the project development process, a large number of paging queries are used. When you want to sort data by date, a lot of duplicate data appears. This problem occurs because the date value is not unique in the data. We know that Oracle does not perform any sorting operations for paging queries, and Oracle reads the qualified numbers from data blocks sequentially.
In the project development process, a large number of paging queries are used. When you want to sort data by date, a lot of duplicate data appears. This problem occurs because the date value is not unique in the data. We know that Oracle does not perform any sorting operations for paging queries, and Oracle reads the qualified numbers from data blocks sequentially.
In the project development process, a large number of paging queries are used. When you want to sort data by date, a lot of duplicate data appears. This problem occurs because the date value is not unique in the data. We know
Oracle does not perform any sorting operations on the paging query. Oracle reads the qualified data from the data block sequentially and returns the data to the client. Oracle sorting algorithms are not stable. That is to say
Data, this algorithm does not guarantee that the data with the same key value is in the order before sorting.
To solve this problem, add a unique column, such as the primary key.
Select * from
(
Select a. *, rownum rn from
(Select * from user u order by u. createdate desc, u. id desc)
Where rownum <= 20
) B
Where B. rn> = 0