Solved

Duplicate Rows Missing in Union Query

Posted on 2008-10-14
3
513 Views
Last Modified: 2012-05-05
Urgent assistance needed from fellow Access/Jet gurus to help me repair a glitch in accounting software.

I have a report that is based on a union query.  The union query joins two simple select queries.

Although the output of the underlying queries appears to be correct, when I view the raw output of the union query it has actually removed duplicate rows from the underlying queries.  This is critical because it is reporting transactions for which the dates and amounts may be identical for unique transactions.

Because the report is working in all other aspects, I prefer a solution that does not change the query output beyond restoring the duplicate rows.  Perhaps there is a DISTINCT keyword or equivalent that I need to mess around with?

Here is the raw union query:

TABLE [Report Cash Account Month]
UNION TABLE [Report Cash Previous Balance]
ORDER BY CashTransactionDate;

Should this cause rows to disappear???
halp.gif
0
Comment
Question by:miqrogroove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 22718540
Union removes duplicates.
Use
Union ALL
0
 
LVL 11

Author Comment

by:miqrogroove
ID: 22718548
peter57r, thanks for the quick reply.  I believe you are correct.  I flipped open mysql.com and in their language it does default to DISTINCT.  I will accept after some testing. :)
0
 
LVL 11

Author Closing Comment

by:miqrogroove
ID: 31506207
My tax returns are saved!  Thank you!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question