> How do I return every third row from a MySQL query, such as "select id, foo from someTable where bar=1 order by id" in an efficient manner, without pulling all the rows into a temporary table? The table has many millions of rows and will not fit in memory.
But all of the solutions that it would come up with would create a temporary table with all the rows. Maybe there is no good solution to the problem.
> How do I return every third row from a MySQL query, such as "select id, foo from someTable where bar=1 order by id" in an efficient manner, without pulling all the rows into a temporary table? The table has many millions of rows and will not fit in memory.
But all of the solutions that it would come up with would create a temporary table with all the rows. Maybe there is no good solution to the problem.