Resolving Oracle Use RowNum sort paging sorting field not only causes paging error ____oracle

Source: Internet
Author: User


From: http://my.oschina.net/ulyn/blog/160520 Click Open link


Recently, when I wrote a list component ulynlist, I found a problem in this record.

Today, List component tuning, I tried to cut down the number of each piece, each page, just completed a footer plug-in time, very happy to point, suddenly point to 10 fishes when found how always is that piece of data, thought is the front-end plug-ins write a problem. After looking at the next console SQL, cut out the SQL to execute, found that is true, from 9 to 13 are the same record.?

1 2 3 SELECT * FROM (select A.*, RowNum RN from (select t.* to t_car_info t WHERE t.del= ' 0 ' and t.id = ' 00 3 ' ORDER by create_time Desc) A where rownum <= where RN >= 10

Normally, this SQL is very difficult to find any problem, in general, our small flow system This create_time is often the only, so it is really difficult to find.

I use Create_timedesc to sort, but the value of this field is copied and pasted because it is a database record, and many records are the same value. This is a typical order by field value that does not uniquely cause paging records to clutter

How to solve it. In fact, it is very simple, as long as in the sort of time to add a unique value of the field on it. Preferably the ID. Change to find out that everything is OK:

?

1 2 3 SELECT * FROM (select A.*, RowNum RN from (select t.*) from
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.