i have 2 tables: genre , movie. genre contains genre_code , genre_desc, while movie has tile, genre_code, etc... trying list genre_desc not not associated title. need use not in , avoid exists.
i have tried -
select genre.movie_genre_desc genre inner join movie on movie.movie_genre_code = movie.genre_code genre.movie_genre_desc not in ([movie].[genre_code]);
i list of desc have titles
you can use sql left join
:
select genre.genre_code, genre.genre_desc genre left join movie on genre.genre_code = movie.genre_code movie.id null
or not in
:
select genre.genre_code, genre.genre_desc genre genre.genre_code not in (select movie.genre_code movie )
first variant should work faster, not in
means not using indexes.
Comments
Post a Comment