I have two tables: users and works
I need write select query for count different names from users table where work_status = 1 from works table

The total is: 3 John, 1 Tom
I need get result:
John 2 (2 because one John work_status = 0 ant this not counting)
Tom 1
I have write select that can count different names, just need compared work_status..
SELECT name,COUNT(*) as num FROM users GROUP BY name
My query return:

user_idvalues in works table