mysql - How to get a SUM of grouped COUNT in SQL Query -
mysql - How to get a SUM of grouped COUNT in SQL Query -
i'm trying sum of grouped count.
my table result this.
id | name | count 1 k 5 2 k 4 3 12
i want result lik this.
id | name | count 1 k 9 3 12
these real query.
select count( clubs_messages.id_user ) nbr, users.name, users.id, users.email users bring together clubs_messages on users.id = clubs_messages.id_user grouping clubs_messages.id_user union select 'sum' users.name, count( clubs_messages.id_user ) users bring together clubs_messages on users.id = clubs_messages.id_user
so help please.
i think have grouping name instead of user_id. check next query
select count( clubs_messages.id_user ) nbr, users.name users bring together clubs_messages on users.id = clubs_messages.id_user grouping users.name
mysql sql-server
Comments
Post a Comment