SQL Server implementation queries the data for article m to nth

Source: Internet
Author: User

1 --Take the record of article M to nth from table tables: (not in version)2 Select TOPN-M+1 * 3  from Table 4 Where(ID not inch(Select TOPM-1Id from Table ))  5 6 7 --Remove the M-to-N records from table tables (exists version)8 Select TOPN-M+1 *  from TABLE  asAWhere  not Exists9(Select *  from(Select TopM-1 *  from TABLE Order  byID) bWhereb.ID=a.id)Ten Order  byID One  A  - --m is superscript, n is subscript, for example, take out 8th to 12th record, m=8,n=12,table is the table name - Select TopN-M+1 *  from Table  the WhereId>(Select Max(Id) from  -(Select TopM-1Id from Table Order  byIdASC)Temp)  - Order  byIdASC

SQL Server implementation queries the data for article m to nth

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.