MYSQL extracts the first and last records of a record. how can this problem be solved?
Source: Internet
Author: User
MYSQL extracts the first and last records of a record. MYSQL extracts the first and last records of a record? How to write? Thank you !,...... This ...... Use SQL statements. MySQl in php does not exist like the recordset in ASP. Therefore, you can only use SQL. That is to say, extract the first and last records of a record by MYSQL.
How does MYSQL retrieve the first and last records of a record? How to write? Thank you!
------ Solution --------------------
......
This ...... Use SQL statements.
MySQl in php does not exist like the recordset in ASP. Therefore, you can only use SQL. That is to say, according to your reading order, three pieces of information are read at a time. The first is the ID of the previous one, the third is the next ID, and the second is the read ID. In this case, it seems that the problem has been solved ...... Put all these items in an array (you can also read the IDs of all the information at a time. However, if the data link is very large, it may be a problem. If you add the limit, you can ~ But there is still a problem ...... A lot of problems ...... When turning pages ...... It seems that this is not a return ......)
How can I find a solution in a few days ~ Busy recently
------ Solution --------------------
SELECT * FROM 'softinfo' WHERE info_id> 20-2 AND info_id <> 20 LIMIT 0, 2 can only be done with incremental segments!
------ Solution --------------------
... You think too much. I don't know how to try it!
------ Solution --------------------
Oh, right. let me think about it again.
------ Solution --------------------
(SELECT * FROM 'softinfo' WHERE info_id <20 order by info_id DESC limit 0, 1) union (SELECT * FROM 'softinfo' WHERE info_id> 20 limit 0, 1) this should be done. I cannot think of any better at the moment.
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.