Another Union query question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What do I need to do.
I am using the same set of fields for 5 union queries.
I want results on a report.
Do I need to change the name of the fields in order to place the 5 results
on a report, and if so, where do I change them? In the query grid, or on
report.?
 
Dar

It sounds like you are asking how to show the separate results of five
separate queries separately in a report. A UNION query does just that,
unifies all (separate) queries into just one.

Mention again how the five separate queries are related ... I seem to recall
different date range criteria, but don't recall what unifies them.
 
Thank you for responding.
There are 5 date ranges prompted by Between statements.
The sum total for those different date ranges need to show up on a report.
Ex. Between date & date Sum = 25
Between another date & another date Sum = 80
Between a 3rd date & a 3rd date Sum = 120.
The field name being summed is the same in all three queries.
I'm just at a loss as to how to get the 25, 80 and 120 to show up on report
one under the other. 25
80
120
 
Dar

Sorry, I am still unclear. What does "25", "80", "120", ... represent? It
sounds like you are saying this is the sum of a field.

Are you willing to step back from the "how" for a moment and describe the
"what"? If I'm not reading too much into what you've described, you want to
end up with a report that shows:

Something 25
Something else 80
Third something 120

To get this, one approach would be to use a UNION query, where the
underlying three queries give you "*Something*" and the number for each
separate query. When you UNION them together, you get three rows. That's
your report, right?

What am I missing?
 
Okay: I'll deal with just the one column. I have PT therapies that record
how many minutes are spent on a patient over a given date range. We need to
look at the sum total for that range, hence the 5 separate queries prompting
5 date ranges. The 25, 80 and 120 were the totals for 3 of the date ranges.
The three rows should alll be labeled Sum of PT or something to indicate
the sum for that date range. Rows should look like this:

Sum of PT Range
25 5 day
80 14 day
120 30 day
I'm open to suggestions if there is another way to get the results. Thanks
for your input, I do check this site throughtout the day for an answer.
 
Dar

So your first query sums the '5 day' range, the second sums ...

In your first query, add a field. In that field, enter "5 day" -- include
the quotes. Use the Totals query type to sum the minutes. Use the date
range as a Where clause.

Do the same with each of the others, using "14 day" and "30 day", as
appropriate.

At this point, you should have three separate queries that return (for
example):

5 day 25
and
14 day 80
and
30 day 120
respectively.

Now, take the SQL statements from each of these and combine them into a
UNION query to get all three.
 
Jeff:
Thank you. I appreciate your response.
It's time to move on to a new question. I will be asking in the form's venue.
 
Back
Top