I am new to MySQL database. So I want to know the exact SQL query to fetch Nth row. Please help me solve this issue. Thanks in advance.
Asked
Active
Viewed 2,130 times
1 Answers
1
SELECT *
FROM YourTable
ORDER BY <somefield>
LIMIT N-1, 1
http://www.w3schools.com/php/php_mysql_select_limit.asp
The SQL query below says "return only 10 records, start on record 16 (OFFSET 15)":
$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 15";You could also use a shorter syntax to achieve the same result:
$sql = "SELECT * FROM Orders LIMIT 15, 10";

Community
- 1
- 1

Juan Carlos Oropeza
- 47,252
- 12
- 78
- 118