Re: Union query filtering duplicated records



I am guessing that you don't need to change this query. You need to change
the UNION query it is built on. In the source query change UNION between
the query clauses to UNION ALL


"cpugh" <cpugh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C0B1C1C8-5882-44BE-8459-0B0CAB9C3D22@xxxxxxxxxxxxxxxx
What do I need to change so this query will not filter out duplicate
records?
I know there is an ALL function but I cannot get the syntax to work.

TRANSFORM Sum([UNION - Gas Revenue and Other Customer Revenue].[Current
Value]) AS [SumOfCurrent Value]
SELECT [UNION - Gas Revenue and Other Customer Revenue].[District Code],
[UNION - Gas Revenue and Other Customer Revenue].Source, [UNION - Gas
Revenue
and Other Customer Revenue].[District Name], [UNION - Gas Revenue and
Other
Customer Revenue].[Report Date]
FROM [UNION - Gas Revenue and Other Customer Revenue]
GROUP BY [UNION - Gas Revenue and Other Customer Revenue].[District Code],
[UNION - Gas Revenue and Other Customer Revenue].Source, [UNION - Gas
Revenue
and Other Customer Revenue].[District Name], [UNION - Gas Revenue and
Other
Customer Revenue].[Report Date]
PIVOT [UNION - Gas Revenue and Other Customer Revenue].Category;



.



Relevant Pages

  • Re: Combining records from two queries
    ... combining UNION and SELECT queries to best effect. ... The list in each case has to have the same number & types of fields (for example, if the first Query begins with a Date/Time field, the second one should do so as well). ... I like to keep my Union Queries short and simple and do the rest of the work elsewhere. ... tblMentors comprises Subject Mentors and Professional Mentors and the Placement subform has a combo for each - the Subject Mentor combo puts the chosen MentorID in the SubjectMentorID field and the Professional Mentor combo puts the chosen MentorID in the ProfessionalMentorID field. ...
    (microsoft.public.access.queries)
  • Re: Graphical Union-Query Builder?
    ... If you are limiting the input in each of the sub-queries in your Union ... Use the filtered queries as the input to your Union query: ... Most "functional IT users" will not know anything about SQL. ... I didn't know that fields of subsequent queries in a Union could have ...
    (microsoft.public.access.queries)
  • Re: Help! Union Query has started crashing!
    ... It's tblSupport on the RLR_SUPPORT_INFOTERRA.mdb database. ... I think I have tracked the problem down to the query ... I also tried a UNION ALL, ... the actual structure of the queries as they have been running fine for weeks. ...
    (microsoft.public.access.queries)
  • Re: Can I simpilify this query?
    ... Thanks...is the query actually adding the quantities and then checking the if result> 0? ... > join ords on product.number = ords.number ... > customer table that a product is supplied to. ... > UNION is because the ords table has 7 fields for the seven days of the week. ...
    (microsoft.public.sqlserver.programming)
  • Re: How to get a distinct count of result set of multople table joins?
    ... since the UNION syntax removes duplicate rows automatically. ...   "SORT " in your execution plan. ... The base query is an outer join. ...
    (comp.databases.oracle.misc)