In MySql I have a complex SELECT which returns a table of about 500k rows and without primary key.
I would like to select 10 rows based on the different position they have in the resulting table, as efficiently as possible.
I tried using LIMIT:
SELECT * FROM table_name LIMIT 5,1;
efficient but select only one row.
I tried with UNION and LIMIT, but I have to do the complex SELECT several times:
(SELECT * FROM table_name LIMIT 5,1)
UNION
(SELECT * FROM table_name LIMIT 1000,1)
UNION
(SELECT * FROM table_name LIMIT 50000,1)
...
Is there a more efficient way to get what I want?