Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grand total query

Status
Not open for further replies.

brianjay

Programmer
Sep 14, 2000
42
US
I have 3 querys:
#1 = sum of all fees paid
#2 = sum of all taxes paid
#3 = sum of all shipping paid

I also have 1 query that houses the 3 sums listed above. I can use "either" /"or".

I need to create a 4th query or field to generate the sum of querys #1,2 & 3.

I'm sure that this is very basic, but I can't find it in my books.

PLEASE HELP ME.

Brian
 
SELECT QrySum_FeeList.SumOfMerch__FeeList, QrySum_Taxes.SumOfMerch__Taxes, QrySum_Shipping.SumOfMerch__Shipping
FROM QrySum_FeeList, QrySum_Taxes, QrySum_Shipping;
 
Code:
SELECT F.SumOfMerch__FeeList,
       T.SumOfMerch__Taxes,
       S.SumOfMerch__Shipping,
      (NZ(F.SumOfMerch__FeeList) +
       NZ(T.SumOfMerch__Taxes) +
       NZ(S.SumOfMerch__Shipping)) As [Grand Total]

FROM QrySum_FeeList F, QrySum_Taxes T, QrySum_Shipping S;

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
I'm betting you can do this in a single query, but you'll have to post the SQL for QrySum_FeeList, QrySum_Taxes, QrySum_Shipping
 
I rewrote the SQL query (made it cleaner) and it produces the correct totals for the individual fields, but I still can't figure out how to create a grand total based on these 3 fields.

SELECT Sum(Tbl_Merchandise.Merch__FeeList) AS SumOfMerch__FeeList, Sum(Tbl_Merchandise.Merch__taxes) AS SumOfMerch__taxes, Sum(Tbl_Merchandise.Merch__shipping) AS SumOfMerch__shipping

FROM Tbl_Merchandise;
 
Code:
SELECT Sum(Tbl_Merchandise.Merch__FeeList) AS SumOfMerch__FeeList, Sum(Tbl_Merchandise.Merch__taxes) AS SumOfMerch__taxes, Sum(Tbl_Merchandise.Merch__shipping) AS SumOfMerch__shipping, [b]Sum(Tbl_Merchandise.Merch__FeeList + Tbl_Merchandise.Merch__taxes + Tbl_Merchandise.Merch__shipping) As [Grand Total][/b]

FROM Tbl_Merchandise

doesn't work for you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top