please see answer which worked if only using data from one staff member this_user='staff3'
HAVING sum(CASE WHEN sender = 'staff3' and this_user='staff3' THEN 1 ELSE 0 END) = 0
I am getting results from profile_id that had messages from other staff1,staff2 and no messages from staff3
so I am trying to add a where clause
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where this_user='staff3'' at line 7