I'm trying to write a query that extracts and transforms data from a table and then inserts that data into another table. Yes, this is a data warehouse query and I executed it in MS Access. So basically I want some query like this:
INSERT INTO Table2(LongIntColumn2, CurrencyColumn2) VALUES (SELECT LongIntColumn1, Avg(CurrencyColumn) as CurrencyColumn1 FROM Table1 GROUP BY LongIntColumn1);
I tried it but got a syntax error message.
If you wanted to do this, what would you do?
You have two syntax options:
Option 1
Option 2
Remember that option 2 will create a table containing only the columns on the projection (the columns on the SELECT).
No "VALUES", no brackets: