If you use the COUNT() function with GROUP BY. It will count the number of rows within each group, not the total number of rows. If you want count the number of rows with the groups, you are not allow use GROUP BY inside the query.
Instead of use GROUP BY you may use DISTINCT inside the query. The DISTINCT function similar with GROUP BY, but it can put inside the COUNT() function.
SELECT COUNT( DISTINCT(id) ) FROM table