I am looking for a way to skip rows in PostgreSQL.
In two ways I can do this:
SELECT * FROM table WHERE id % 5 = 0
However, I would need to get consecutive lines in order to skip correctly. For example, if I get a line (with identifiers) of 0.3.5, it will not skip 4 out of 5 lines, but instead will result in (ids) 0 and 5.
Or skip outside of SQL:
$count = 0; while($row = progres_fetch_row($result)) if ($count++ % 5 == 0) // do something
What is the fastest way to get every nth row from an SQL database?
sql postgresql
Robotrock
source share