How can I get total of a table

BizBoy

Board Regular
Joined
Jul 26, 2012
Messages
118
Hi,
I am using below query to get details.

SELECT Designation, Count(Designation) AS Total
FROM Combine
WHERE MyDate = #5/7/2018#
GROUP BY Designation
ORDER BY Count(Designation);

This query gives me number of people for each designation from the table.
How can get sum of number of people for each designation.

Can anyone please help me in this.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi, since people are not numbers a count and a sum would be the same!

ex.
1, 2, 3 --> count is three and sum is 6
John, Sally, Mary --> count is three, and "sum" is also three.
 
Upvote 0
Hi xenou,

Sorry for confusing you. I am getting correct counts by this query.
I am trying to get total people present in database.

For example, my database has 50 managers and 5 workers.
My query is giving correct result,
managers = 50
workers = 5

However I want to add total below these two.
So result will be something like this.

managers = 50
workers = 5
Total = 55

Have a nice day ahead. :)
 
Upvote 0
You would need two queries:
Code:
SELECT Designation, Count(Designation) AS Total
FROM Combine
WHERE MyDate = #5/7/2018#
GROUP BY Designation
ORDER BY Count(Designation)

UNION ALL

SELECT 'Total' as Designation, Count(*) AS Total
FROM Combine
WHERE MyDate = #5/7/2018#
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top