Why am i seeing 'mixing of group columns' in sql?

Example:

SELECT name, COUNT(id) FROM users GROUP BY id;

You're grouping by one column and trying to select another without using an aggregate function.

Solution:

Ensure that all columns in the SELECT statement that aren't used in aggregate functions are included in the GROUP BY clause.


SELECT id, name, COUNT(*) FROM users GROUP BY id, name;

Beginner's Guide to SQL