Daffy Duck wrote:Hi I want to grab 1m rows from a db starting from row 5m to row 6m
I did this..
INSERT INTO table1 (domain) SELECT domain FROM table2 LIMIT 5000000, 6000000;
But it inserted 6m rows
Whats wrong with the above?
It did exactly what you told it to.
The args to limit are offset, limit. So you told it to give you 6m rows offset by 5m.
If you use the limit/offset syntax it's more obvious:
INSERT INTO table1 (domain) SELECT domain FROM table2 LIMIT 1000000, offset 5000000 -- not sure if the , is normal in mysql
Notice that it's much more readable and understandable.