Batch query of Database Data

Source: Internet
Author: User
Data batch query data some time ago due to activities of online projects, we found that when we requested data from a third-party system, the requested data volume reached more, the requested data is in the form of an Http request. I did not expect that there would be so much data in advance, so I can only request data from other systems in batches, with 200 requests each time. The specific situation is as follows:

Data batch query data some time ago due to activities of online projects, we found that when we requested data from a third-party system, the requested data volume reached more, the requested data is in the form of an Http request. I did not expect that there would be so much data in advance, so I can only request data from other systems in batches, with 200 requests each time. The specific situation is as follows:

Data batch query data some time ago due to activities of online projects, we found that when we requested data from a third-party system, the requested data volume reached more, the requested data is in the form of an Http request. I didn't expect that there would be so much data in advance, so I could only request data from other systems in batches, with 200 requests each time. The specific situation is: there is a table in the database. The main fields are user_id (User Name) and count (item quantity). The system requires that the user's item quantity be updated in real time, however, the interface for saving the number of items is not in its own system, so you need to remember the system request data, mainly how to obtain the user user_id each time without repeating. We mainly learn how to use Database SQL statements:
Select top 200 user_id from (SELECT (Row_number () OVER (order by user_id) as ix, user_idFROM [xxx]. [dbo]. t_world_cup_exchange_user_flag_list group by user_id) ttwhere tt. ix >#{ index, jdbcType = VARCHAR}
We mainly use database functions. Row_number generates a specific serial number for the returned result set. This function can be used to request data with 200 different users each time, such as from 0 ~ 200,201 ~ 401,401 ~ 601 ...... This sequence starts to select the user ID you need. Of course, you need to save the index cursor value in your program and keep it in a loop. --- The road is long, and I will go up and down

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.