Insert Into with a UNION Query

  • Thread starter Thread starter Chris Nebinger
  • Start date Start date
C

Chris Nebinger

How About:


INSERT INTO UHC_STAGING
Select * from (
Select wkly.* form wkly UNION Select * from Biwkly) as
qryAppend


Chris Nebinger


-----Original Message-----
How can I create a Insert Into with a Union query in one>SELECT wkly.*
INTO UHC_Staging
FROM wkly
UNION SELECT biwkly.*
FROM biwkly;
SQL statement without creating 2 independent queries?
Here 3 ways I tried it and none of them worked:
 
I tried that and it gives me a syntax error on the first FROM (Select * From). It should work you think, but it doesn't.

It works if you first create a query called qryAppend with the following SQL then save it.
Select * from wkly UNION Select * from Biwkly

then create another query called qryInsert with the Following SQL then save and run. The it works fine. I don't know why.

INSERT INTO UHC_Staging
SELECT *
FROM qryAppend

Which is what I want to avoid. I want to create this SQL statement and plug it into my VB code instead of creating to independent recordsets.
 
Back
Top