View Single Post

   
  #2 (permalink)  
Old 02-29-2008, 03:37 AM
David Portas
 
Posts: n/a
Default Re: SQL many-to-many query problem. HELP !

SELECT S.sport_id, S.sport_name
FROM tblSports AS S
WHERE NOT EXISTS
(SELECT *
FROM tblJoin
WHERE sport_id = S.sport_id
AND team_id = ???)

SELECT T.team_id, T.team_name
FROM tblTeams AS T
WHERE NOT EXISTS
(SELECT *
FROM tblJoin
WHERE team_id = T.team_id
AND sport_id = ???)

--
David Portas
SQL Server MVP
--


Reply With Quote