Totals in select queries

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?
 
G

Guest

Maybe if you add their aliases like

Select sum(parts) as a1, sum(sales) as a2, (a1 + a2) as grandtotal
(e-mail address removed)
 
T

Tonín

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
 
J

John Vinson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top