Home >Database >Mysql Tutorial >How to Retrieve the N-th Record from a MySQL Query?
Retrieving Specific Records from MySQL Queries
When working with large datasets, it may be necessary to retrieve a specific record based on its position in the result set rather than its unique identifier. This can be achieved using MySQL's LIMIT clause, which allows you to specify the number of records to return from a query starting at a certain offset.
To return the n-th record from a MySQL query (based on ascending ID order), you can use the following syntax:
SELECT * FROM table ORDER BY ID LIMIT n-1,1
Here's how this query works:
The above is the detailed content of How to Retrieve the N-th Record from a MySQL Query?. For more information, please follow other related articles on the PHP Chinese website!