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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help

Status
Not open for further replies.

AGoodGuy

Programmer
Aug 16, 2011
32
I have Query 1 results - AAL Male 23

I have Query 2 results - AAL Female 33


How to combine the two queries to get the results below:

AAL Male 23
AAL Female 33

Would I need to a union query?
 
A union query will give you the results you want. Without knowing more about your queries, it is not possible to say whether it is necessary. If the data comes from the same table(s), then making one query is likely possible. If it is different tables, go with the Union.

Noteworthy is that Union queries are a performance hit and should be avoided if possible.
 


Please post the SQL for each query.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
They will be slow to retrieve the results

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
r937,

MazeWorX is right. There is not much more to add to the fact that Union queries run comparatively slower to non-union queries. It is much more significant than you might expect. You would expect if both queries took 10s to run the Union would take about 20s. Access is bad at stacking the results caused by a Union. The union will likely take longer than the 20S you'd expect. Sometimes a Union is the right answer, all I am pointing out is that you might have a long running query.

In this case where there are 2 records, it probably would not be a noticeable difference.
 
A typical union query can be quite slow since it spends time searching for and eliminating duplicates. Using "union all" will increase the speed of a union tremendously.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top