Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do get a query to show records from other queries? 1

Status
Not open for further replies.

daveh

Technical User
Jun 22, 2000
57
GB
Hi

The question sounds simple but its not quite as simple as it might sound. I have got 4 queries, all of which have exactly the same fields, but each have slightly different criteria. The fields are all numbers, calculated as the averages of some other queries.

What I want is a query that brings these queries together into one query, so that rather than having four seperate queries with the following...

A1 A2 A3 A4 A5 A6 A7 A8

I instead want:

A1 A2 A3 A4 A5 A6 A7 A8
B1 B2 B3 B4 B5 B6 B7 B8
C1 C2 C3 C4 C5 C6 C7 C8
D1 D2 D3 D4 D5 D6 D7 D8

all in one table so that I can copy and paste the contents. At the moment I have to run each individual query to give me a single line, and then copy and paste them individually into a spreadsheet.

Thanks,
Dave.
 
Sounds like UNION

Code:
SELECT * FROM query1
UNION
SELECT * FROM query2
UNION
SELECT * FROM query2
...

;-)

Cheers,
Andy

[blue]An eye for an eye only leaves the whole world blind. - "Mahatma" Mohandas K. Gandhi[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top