Log in

View Full Version : Sum Query



kbsudhir
02-15-2008, 03:35 PM
Hi

I have a table in which I store the #of errors for my team.

I have a query which counts #of errors done by the each teammate in a period of time.

But what I need is the sum of all to get the #of errors commited by the whole team.

Ex.

Name NoOfErrors

Abd 20
XYZ 40
IRC 75

I need the sum of NoOf Errors Column in the last row
Like:

Total 125

How to do it.

:banghead: :banghead:
Any help in in this regard is appreciated.

majaro
02-15-2008, 05:55 PM
I assume that Abd 20 is not in one field?

asingh
02-15-2008, 08:00 PM
This is what I could think off...

SELECT Sum(tbl_errors.Number_of_errors) AS SumOfNumber_of_errors
FROM tbl_errors;

Here..there is a table..tbl_errors..which has two fields....name and Number_of_errors...a group by query is created which just sums up the error numbers for each name.and displays it in a single cell.

Hope this helps...

asingh

kbsudhir
02-20-2008, 08:48 AM
Thanks it helped a lot.

But have a question here.

PLease refer to the attached. Its the screenshot of my query.

After End of the last row I need another row-
In first Column - "Total"
And rest of the columns I need the total of each column.

Can this be done......????????????????

If Yes, Then How...????????????


All the help is appreciated.

Thanks
Sudhir

asingh
02-22-2008, 09:19 PM
What you want is...that

For Aeleta Tiglao the sum of Total Skus + Total Changed + Group changed..etc...to show in a column at the end..???

kbsudhir
02-23-2008, 07:19 PM
No, I need the total of each category i.e. TotalSkus, Total Changed etc

This will give me Sum of each category for the whole team as a whole.
Ex Sum of Total Skus is 14388

i.e. Sum of
270347075195173745437246522392550

I.e values corresponding for each associate in the total skus column.

Thanks
Sudhir

kbsudhir
02-23-2008, 07:23 PM
Please refer this data as the last one is being shown as one complete figure -
2703+4707+519+517+3745+437+246+522+392+550

Sorry for the confusion caused by the earlier example.

Thanks
Sudhir

asingh
02-26-2008, 07:20 PM
Hi,

Attached is a DB (data is different to yours though)....

the query qry_select_sum does the job.

regards,

asingh