merging two queries in one

J

Jan Coucke

Hello,

Is it possible to make a new query based on two older queries with the same
2 fields? The new query schould contain those 2 fields with the information
from the first and the second query.
 
F

fhunth

Have you rode about UNION



you can make an union of two queries



SELECT FIRSTNAME FROM CLIENTS

UNION

SELECT FIRSTNAME FROM VENDORS
 
N

news.microsoft.com

Hello,

thx for your quick answer but it still have a problem.
after making my query with the UNION instruction it didn't show me all my
records. The query deleted all the equal records. Is there a possibility
that i can see all my records?
 
F

fhunth

It is true UNION makes a DISTINCT query.

You can solve it like here:



SELECT FIRSTNAME,'C' FROM CLIENTS

UNION

SELECT FIRSTNAME,'V' FROM VENDORS



so as to identify the record
 
J

John Spencer (MVP)

You can replace UNION with UNION ALL.

UNION returns DISTINCT records. UNION ALL returns "All" records.
 

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