Discussion Locked

Union does returns inproper num. of rows

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Select txtcountry,txtfilingno,txttaxdate,txttafinitials from 1Q02
Union Select txtcountry,txtfilingno,txttaxdate,txttafinitials from 2Q02
Union Select txtcountry,txtfilingno,txttaxdate,txttafinitials from 3Q02
UNION Select txtcountry,txtfilingno,txttaxdate,txttafinitials from 4Q02;

When I add up the record count for those tables, it is not the same number as my rows returned from the union statement. Not really familiar with writing unions. Any ideas?

6 replies

by georgevlob

The fourth line should be as follows:

UNION ALL Select txttxtcountry,txtfilingno,txttaxdate,txttafinitials from 4Q02;

by georgevlob

A little info on the ALL option. Access eliminates duplicate lines, the ALL tells Access to include every line even if duplicate. This will also speed up your query because Access does not have to check every line.

by georgevlob

A little info on the ALL option. Access eliminates duplicate lines, the ALL tells Access to include every line even if duplicate. This will also speed up your query because Access does not have to check every line.

This discussion is closed to new replies.