SQL Query

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.
 
K

KARL DEWEY

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];
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top