There are three tables in my database, called profiles
, profile_groups
& profile_group_members
.
profiles
contains basic details about employess (user_id,firstname, lastname, email)
profile_groups
contains profile groups such as executives, clerical_staff, support_staff (group_id, group_name).
profile_group_members
contains members in each groups.(id, group_id, user_id).
Now I want to list users who are not already in a specific group.
For an example : I want to list users who are not already in group_id 2
I found various articles from Stackoverflow but any of them not worked for me.
Please help me to write the code.
Edit : @Paul's code works!!