Maison >base de données >tutoriel mysql >Comment récupérer le Nième enregistrement d'une requête MySQL sans connaître son ID ?
How to Extract a Specific Record from a MySQL Query
When dealing with databases, retrieving specific data points is crucial. In the case of MySQL, users often need to retrieve a particular record from a query, especially without knowing its identifier directly. This article addresses this issue by providing a detailed solution for returning the nth record from a MySQL query.
To achieve this objective, the following syntax is employed:
SELECT * FROM table ORDER BY ID LIMIT n-1,1
This statement specifies the following criteria:
By utilizing this approach, users can effectively return any desired record from a MySQL query, regardless of its ID, based solely on its position in the sorted result set.
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!