MySQL – Easy way to insert rows from one table into a secound

If you are one of the persons there can rip your hair of your head when customers asking you to adding a lot of rows from your MySQL table to another table based on certain requirements.

Then take this little tip possibly helping you to a fun business day

INSERT INTO
   table1 (field1,field2)
 
SELECT
   t2.field1, 
   t2.field2 
 
FROM 
   table2 t2;

I hope you enjoyed this little tip to make your workday more fun.

Leave a Reply

Your email address will not be published. Required fields are marked *

*