I want to SELECT all rows except for the first 5 rows in a table.
How do I do that?
Why cant I just type
$query = "SELECT * FROM ages OFFSET 5 ORDER BY id ASC";
I want to SELECT all rows except for the first 5 rows in a table.
How do I do that?
Why cant I just type
$query = "SELECT * FROM ages OFFSET 5 ORDER BY id ASC";
SELECT * FROM tbl LIMIT 5,18446744073709551615;
from http://dev.mysql.com/doc/refman/5.0/en/select.html
To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:
SELECT * FROM tbl LIMIT 95,18446744073709551615;
I just typed:
$query = "SELECT *
FROM ages
LIMIT 100
OFFSET 10";
Why couldn't anybody give me such an easy answer? :)
Here's a solution using variables - just add your order by clause and you should be set.
set @n=-1
select * from TABLE where (@n:=@n+1) >= 5;