INSERT INTO Orders ( userid, timestamp) SELECT Orders.userid, Orders.timestamp FROM Users INNER JOIN Orders ON Orders.id = Users.id
Here is what the above code is Doing:
1. Create a new table called Orders.
2. Insert the userid and timestamp columns from the Orders table into the new Orders table.
3. Select the userid and timestamp columns from the Orders table and the Users table.
4. Join the Users table to the Orders table on the id column.