select every other row in MySQL without depending on any ID?
问题 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? 回答1: 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. 回答2: This works for me. SET @row_number = 0; select* from ( SELECT (@row_number:=@row_number + 1) AS num,