How to do INSERT into a table records extracted from another table

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2008-09-16T16:19:55Z Indexed on 2010/06/16 8:22 UTC
Read the original article Hit count: 210

Filed under:
|

I'm trying to write a query that extracts and transforms data from a table and then insert those data into another table. Yes, this is a data warehousing query and I'm doing 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 but get a syntax error message.

What would you do if you want to do this?

© Stack Overflow or respective owner

Related posts about sql

Related posts about ms-access