I have two tables, one has user information the other has users who are on a team. The result set from the query below gives me the information I want, except for it includes the people from the user table that are already on teams (and displays them multiple times).
We know a user is on a team if they have an entry in the team_member table. So how can I exclude the userIDs from the result set that are already in the team_member table? I need to do this in one query. I am working from SQL Server.
Thank you very much!
SELECT dbo.tbl_user.display_name, dbo.tbl_user.userID, dbo.tbl_user.state, dbo.tbl_user.city, dbo.tbl_user.countryFROM dbo.tbl_user, dbo.team_memberWHERE (profile_type = 1) AND (drop_out = 0) AND team_member.userID <> tbl_user.userIDORDER BY display_name