I'm trying to do a complex INSERT into a table. What makes it complicated is that I need to join two tables first, then insert the results of that table into a third table. Here's an example:
This is the query table:
SELECT tableA.ordid, tableA.custid, tableA.date, tableB.custname
FROM tableA LEFT OUTER JOIN tableB ON tableA.custid = tableB.custid
This is the table I want to insert results of the query table into:
INSERT INTO tableC SET tableC.ordid = queryTable.ordid, tableC.date = queryTable.date, tableC.custname = queryTable.custname
How do I do this with one statement if possible?