i have two tables linked in a query...one table is title the other is actor...i want to see what titles dont have actors but all i am getting are records that have both....how do i accomplish this
i have two tables linked in a query...one table is title the other is actor...i want to see what titles dont have actors but all i am getting are records that have both....how do i accomplish this
AjeTrumpet gave you the general outline, but I'll fill in some of the details. He's referring to to this type of query.
SELECT * FROM Titles
LEFT JOIN Actors
ON Titles.TitleID = Actors.TitleID
WHERE Actors.TitleID IS NULL
The above is difficult to understand if you're an absolute beginner. You can rewrite this query in a way easier to understand (but it runs slow this way).
SELECT TitleID FROM Titles
WHERE TitleID NOT IN
(SELECT TitleID FROM Actors)
In both cases, this should report those titles that exist in the Titles table but do not exist in the Actors table (titles without actors). Or if you want those actors without titles:
SELECT TitleID FROM Actors
WHERE TitleID NOT IN
(SELECT TitleID FROM Titles)