
Sam Z. answered 08/27/20
Full Time Data Analyst at Amazon
If I'm understanding the problem correctly, it's that the original table "user" has 58 users in it that, first, you want to have grouped into towns (for example, with three towns one town will have 20 users, another 30 and another 8), but you also want the total available as well.
There are a few ways to do this, but I think putting a "count" function in the select statement will do what you need. It essentially gets the total without the grouping and puts it back in the "grouped" table.
Here's an example:
You can view this in action at the following sqlfiddle link: http://sqlfiddle.com/#!7/29558/1