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
yes possible using temp variable
Example :
set @a := 0;
select * from car_m_city WHERE mod((@a:=@a+1), 2) = 1
Explanation :
here in sql we declare @a( set @a := 0;
) temp variable.(@a:=@a+1)
now @a
increment by 1.jsut like simple way to check odd or even
mod((@a:=@a+1), 2) = 1
for odd data
mod((@a:=@a+1), 2) = 0
for even data