Skip to main content
Source Link
bluetxxth
  • 121
  • 3
  • 17

Count unique ids on right table

I have a mysql statement as follows:

SELECT * FROM class_members WHERE class_id = 1; 

Which returns the following result:

class_id | user_id 1 | 2 1 | 1 1 | 3 1 | 5 

I want to count all the unique user_ids per class.

Can anyone help?

Thank you