Skip to content
Loading
  • Rajanikant Hawaldar
    +2
    Correct me if I understand wrong https://www.w3resource.com/mysql/inserting-updating-deleting/insert-with-left-join.php https://stackoverflow.com/questions/20404682/sql-insert-into-from-multiple-tables/20404789 https://stackoverflow.com/questions/52382378/insert-statement-with-a-join-between-two-tables https://dba.stackexchange.com/questions/71852/how-to-insert-values-into-a-table-from-two-different-tables
    +2
  • Vishvjit Shinde
    +2
    1. Insert into YourTable(column1,column2)  
    2. select a.column1,b.column2 from Table1 a  
    3. [YourJOin]  
    4. Table2 b  
    5. on a.id = b.id  
    +2
  • Jignesh Kumar
    +1
    Hi Saurabh,
     
    Please use below query,
    1. Insert into table3 values(column1,Column2, Column3)  
    2. SELECT Column1, Column2, Column3 frOM Table1 t1  
    3.    INNER JOIN table2 t2  
    4.    ON t1.Id= t2.Id  
     
    +1
  • Amira Bedhiafi
    +1
    Can you please share a sample of your data ?
    +1
  • Harsh Shah
    +1
    INSERT INTO Table1 (column1, column2)
    SELECT a.column1, b.column2
    FROM TableX a
    INNER JOIN TableY b ON a.id = b.id
    +1