Simple job, all I need is a mysql JOIN query written. I need to select all users who do not belong to a specific team. Database Tables users: id, username users_teams: id, team_id, user_id EX. If there are 3 users, User1, User2, User3 If user1 and user2 are assigned to team_id 1, I need for the query to only select User3. Keep in mind that users can belong to multiple teams. If you're interested PM me your skype, aim, or gtalk details.
try this select u.id, u.username from users u left join users_teams t on (t.user_id=u.id) where t.user_id is not null Code (markup): or select u.id, u.username from users u where u.id not in (select distinct user_id from users_teams) Code (markup):