INSERT INTO Table from multiple tables

前端 未结 3 510
忘了有多久
忘了有多久 2020-12-05 05:35

Hey so I have a Junction table linking two unrelated tables. Both the tables have ID\'s. I need to select the ID from each table using WHERE<

3条回答
  •  感动是毒
    2020-12-05 06:02

    Another way can be

    INSERT INTO c (aID, bID)
    SELECT 
       (SELECT A.id FROM TableA A WHERE A.names = 'sometext'), 
       B.id FROM TableB B 
    WHERE 
       B.x_name ='othertext';
    

提交回复
热议问题