How to obtain the next record based on products_id 6
Source: Internet
Author: User
How to obtain the previous record of products_id 6. How to obtain the previous record of products_id 6. Note that the products_id & lt; 6limit1 condition cannot be used, because products_id is a random arrangement of the size, select * fromttwhereproducts_id & lt; 6or how to retrieve the previous record based on products_id 6.
How to obtain the previous record of products_id 6.
Note that the products_id <6 limit 1 condition cannot be used, because products_id is a random array of sizes.
------ Solution --------------------
Select * from tt where products_id <6 order by products_id desc limit 1
------ Solution --------------------
Select * from tt where price. products_id <6 and price. price = '000000' order by price. products_id desc limit 1, try
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