Totals in select queries

  • Thread starter Thread starter mtress
  • Start date Start date
M

mtress

I've done a query which gave me sums of quantities for
different items. Now how do I get a grand total for all
the sums, in the same query?
 
Maybe if you add their aliases like

Select sum(parts) as a1, sum(sales) as a2, (a1 + a2) as grandtotal
(e-mail address removed)
 
Usually that sort of "merge" queries are not a good practice. Just remember
a query is not just an spreadsheet.[Think if you can get the desired result
using calculated fields on a report].
However, you CAN get a query to do what you need: First, you should write a
second query, based on the first one, to calculate the Grand Total. After
that, you can perform a UNION query just to show all results together. [BTW,
that will be a non updatable query].

If you want a detailed SQL solution, then It would be better if you post
your original query.


:-)

Tonín
 
I've done a query which gave me sums of quantities for
different items. Now how do I get a grand total for all
the sums, in the same query?

As Tonin suggests, it's best not to use query datasheets for display
purposes.

I'd suggest creating a Report based on your query (for printing), or a
Form (for onscreen viewing). You can put a textbox in the Report or
Form Footer with a control source

=Sum([quantity])

to display a grand total.

John W. Vinson[MVP]
(no longer chatting for now)
 
Back
Top