UNION vs UNION ALL

G

Guest

I'm using a UNION query to join survey results for different types of
questions (rating questions are in one table, text answers are in a different
table). I ran into a situation where using UNION ALL to get data from the two
tables was only bringing back data from the first table in the query. But,
when I changed it to UNION (*not* UNION ALL), all data were brought back.

I thought that UNION ALL is needed to ensure all data are brought back. Why
would using UNION ALL in my case actually return *less* data?

I can post my query if needs be, but I was wondering if this was more of a
general phenomenon and not necessarily limited to my query.

Thanks
rachael
 
M

Michel Walsh

Hi,



Should not. UNION ALL should return all the records, while UNION would also
acts like a DISTINCT over the union. As example, a table, with dup, union
with itself will produce less record than there is in the table itself, but
with UNION ALL, it will return twice the number of initial records in the
table.


Hoping it may help
Vanderghast, Access MVP
 

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

Similar Threads

union query 4
Union Query 0
Using CheckSums to insure data integrity 3
Union Queries - Record Formatting 1
Union query 5
Run Make Table Query on Union Query 2
Union All Query bombs report 2
union query problem 16

Top