select every other row in MySQL without depending on any ID?

mysql, sql

Solution

In unique MySQL fashion:

select  *
from    (
        select  *
        ,       @rn := @rn + 1 as rn
        from    Table1
        join    (select @rn := 0) i
        ) s
where   rn mod 2 = 0 -- Use = 1 for the other set

Example at SQL Fiddle.

Problem

Considering following table that doesn't have any primary key, can I select every other row? ``` col1 col2 2 a 1 b 3 c 12 g ``` first select must find: 2, 3 second select must find: 1, 12 is that possible?

Original source

Related problems