Columns with different row sources

Z

Zachary Turner

Suppose I've got all these tables spread out, and I want to pull data
from multiple tables and link them together in such a way that no
column in my result set comes from an actual table, but rather from the
result of a query. and each as the result of a different query at
that. How can I do it? One solution I can think of would be to run
multiple queries sequentially and save their results in temporary
tables, and then use those temporary tables, but I don't know a syntax
for saving these values? For example, I go to the query list and
create new query. I go to SQL View and now I can type a bunch of
stuff. If I could find a way to run three queries in a row, where the
third query uses the result of the first and second query in it's FROM
clause, then this would probably work. Is there a syntax for this? I
know I can do

SELECT * FROM Table1 WHERE foo;
GO;

SELECT * FROM Table2 WHERE bar;
GO;

But then I want something like

SELECT * FROM ResultOfQuery1, ResultOfQuery2
Thanks kindly,
Zachary Turner
 
J

Joseph Meehan

Zachary said:
Suppose I've got all these tables spread out, and I want to pull data
from multiple tables and link them together in such a way that no
column in my result set comes from an actual table, but rather from the
result of a query. and each as the result of a different query at
that. How can I do it? One solution I can think of would be to run
multiple queries sequentially and save their results in temporary
tables,

Almost. Hint: You can use a Query as a source for a Query as if it
were a Table.
 

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