adding up columns in queries?

  • Thread starter Thread starter scott
  • Start date Start date
S

scott

I have information in tables that I am making a query for.
It looks something like this.

Price State Tax Local Tax Equipment Charge.

Is there a way to add each column to show in the query so
it would look something like this.

1.00 1.00 5.00 10.00
1.00 1.50 3.00 15.00

2.00 3.00 8.00 25.00

total 38.00

Thanks
Scott
 
-----Original Message-----
I have information in tables that I am making a query for.
It looks something like this.

Price State Tax Local Tax Equipment Charge.

Is there a way to add each column to show in the query so
it would look something like this.

1.00 1.00 5.00 10.00
1.00 1.50 3.00 15.00

2.00 3.00 8.00 25.00

total 38.00

Thanks
Scott
.
I don't think you can do that in a query but using a
query for a report will give you the info you need.
 
Although a report would work better, here is what you asked for:

Using tblNumbers as your table name, use 2 queries...
Call this one qSumNumbers
SELECT Sum(tblNumbers.Price) AS SumOfPrice, Sum(tblNumbers.[State Tax]) AS
[SumOfState Tax], Sum(tblNumbers.[Local Tax]) AS [SumOfLocal Tax],
Sum(tblNumbers.[Equipment Charge]) AS [SumOfEquipment Charge]
FROM tblNumbers;

then use.
SELECT 1 as ID, Price, [State Tax], [Local Tax], [Equipment Charge]
FROM tblNumbers
UNION ALL
Select 2 as ID, SumOfPrice, [SumOfState Tax],[SumOfLocal
Tax],[SumOfEquipment Charge]
FROM qSumNumbers
UNION ALL
Select 3 as ID, SumOfPrice + [SumOfState Tax]+[SumOfLocal
Tax]+[SumOfEquipment Charge], Null, Null, Null
FROM qSumNumbers;
 
Hi,

I got the first query to work great..I am unsure what I am
supposed to do with the 2nd one and where I am supposed to
put it.

Thanks!
Scott
-----Original Message-----
Although a report would work better, here is what you asked for:

Using tblNumbers as your table name, use 2 queries...
Call this one qSumNumbers
SELECT Sum(tblNumbers.Price) AS SumOfPrice, Sum (tblNumbers.[State Tax]) AS
[SumOfState Tax], Sum(tblNumbers.[Local Tax]) AS [SumOfLocal Tax],
Sum(tblNumbers.[Equipment Charge]) AS [SumOfEquipment Charge]
FROM tblNumbers;

then use.
SELECT 1 as ID, Price, [State Tax], [Local Tax], [Equipment Charge]
FROM tblNumbers
UNION ALL
Select 2 as ID, SumOfPrice, [SumOfState Tax],[SumOfLocal
Tax],[SumOfEquipment Charge]
FROM qSumNumbers
UNION ALL
Select 3 as ID, SumOfPrice + [SumOfState Tax]+[SumOfLocal
Tax]+[SumOfEquipment Charge], Null, Null, Null
FROM qSumNumbers;

scott said:
I have information in tables that I am making a query for.
It looks something like this.

Price State Tax Local Tax Equipment Charge.

Is there a way to add each column to show in the query so
it would look something like this.

1.00 1.00 5.00 10.00
1.00 1.50 3.00 15.00

2.00 3.00 8.00 25.00

total 38.00

Thanks
Scott


.
 
Back
Top