How can I reset the index of the rows?
I believe id is autoincrement field, and you want this value to start with 1 in new table.  You can specify column list in your first query, so it won't fail :

INSERT INTO test2 (`timestamp`, datenum) 
SELECT `timestamp`, datenum 
FROM test1 WHERE datenum&gt;=23 and datenum&lt;=1000000