I have a simple SQL insert query, however two of the data entires come from two other tables,
I know how to get data from from one table in an insert but how do i get data from two tables?
Example (One Table Data)
INSERT INTO TABLE (COL1, COL2, COL3) SELECT :COL1, :COL2, TABLE2.ID FROM TABLE2 WHERE TABLE2.NAME = :LEVEL0
The above works fine and pulls relevant data out of table2, issue is i need to add a third table.
INSERT INTO TABLE (COL1, COL2, COL3, COL4) SELECT :COL1, :COL2, (TABLE2.ID FROM TABLE2 WHERE TABLE2.NAME = :LEVEL0), (TABLE3.ID FROM TABLE3 WHERE TABLE3.NAME = :LEVEL1)
doesn't work i get SQL errors
Im stumped about how else to do this
Thanks
Aucun commentaire:
Enregistrer un commentaire