SQL Query

  • Thread starter Thread starter Erica
  • Start date Start date
E

Erica

Hi I am not a programmer but many years I got a stack sql query off this
discussion group that I used for many projects. I recently left my previous
employment and meant to copy down that query before I left and of course now
I need it.

I have two querys wth three columns
One query has ID, Current Data Date and Current Data Rate
The other query has ID, Previous Data Date and Previous Data Rate

I have a table with no data
it has ID, Data Date and Data Rate

I want to stack the two queries to poulate this table using SQL.

I vaguely remember the code as
Update Table1
Select * Query 1
Select * Query 2
Submit;

Of course this isn't working and since I have no experience with SQL I can't
figure out what is missing or wrong.

Thank you in advance for any assistance.
 
Try this ---
INSERT INTO Table1 ([ID], [Data Date], [Data Rate])
Select ID, [Current Data Date], [Current Data Rate]
FROM [Query 1]
UNION ALL Select [ID], [Previous Data Date], [Previous Data Rate]
FROM [Query 2];
 
Hi I am not a programmer but many years I got a stack sql query off this
discussion group that I used for many projects. I recently left my previous
employment and meant to copy down that query before I left and of course now
I need it.

I have two querys wth three columns
One query has ID, Current Data Date and Current Data Rate
The other query has ID, Previous Data Date and Previous Data Rate

I have a table with no data
it has ID, Data Date and Data Rate

I want to stack the two queries to poulate this table using SQL.

I vaguely remember the code as
Update Table1
Select * Query 1
Select * Query 2
Submit;

Of course this isn't working and since I have no experience with SQL I can't
figure out what is missing or wrong.

Thank you in advance for any assistance.

You can stack queries in SQL/Server but you cannot do so in Access. Perhaps
you could describe what you're trying to accomplish and the nature of your
tables.
 
Back
Top