DB2 sorting page summary

Source: Internet
Author: User


First, SELECT * FROM (SELECT row_number () OVER () AS rown, CC_BRAND. * FROM CC_BRAND order by CC_BRAND.BRAND_CODE) as awhere. ROWN> = 1 AND. ROWN <= 10; my idea is as follows: I regard the running results marked in red in the first paging SQL statement as a result view. Then select and query the ROWN field in it. I feel that there is no task problem, but the result is wrong. I am puzzled when I run the red annotation part. The operation is completely correct, but all the operations are incorrect and the sorting is disordered. It is totally different from the sorting result of the red annotation part, finally, we searched for the "Sort distribution" example on the Internet and modified it. -www.2cto.com-AS follows: SELECT * FROM (SELECT row_number () OVER (order by CC_BRAND.BRAND_CODE) AS rown, CC_BRAND. * FROM CC_BRAND) as awhere. ROWN> = 1 AND. ROWN <= 10; the Blue annotation is different. You need to put the order in the brackets after over to sort the pages correctly. Author jvortex

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.