Let's say I have a table like this:
create table table_name (
In reality this is a transactions table joined with a users table. It is important to note that my users table has some distinct users with the same name.
We do a summary report with something like
select case(grouping(user_id) when 0 then user_id when 1 then 'total' end) as user_id, count(transaction_id) as no_transactions
group by user_id
This produces a table like
I would very much like to see a table like
If I group by name instead of id, then the two Alices get combined into one. If I group by both name and id, then I get a summary row for every name, which I do not want. Is it possible?