我有两张桌子 - artist and album
列 <{1}}
中的列
我想找到专辑表中所有不在艺术家表格中列出的类型的艺术家(更具体一点 - 如果艺术家X有流派'pop'和'rock'注册但生成一个带有流派的专辑Y '经典',然后应该列出艺术家,专辑和流派。
答案 0 :(得分:1)
试试这个:
select artist_name, name, album_genre
from album alb
where album_genre not in (select distinct artist_genre
from artist
where name = alb.artist_name)
<强> SQL Fiddle Demo 强>
答案 1 :(得分:1)
select artist_name, name, album_genre
from album left join artist on artist.name = album.artist_name and album_genre = artist_genre
where artist.id is null
答案 2 :(得分:0)
这个怎么样..
"SELECT artist_name FROM album, artist WHERE artist_name = name AND album_genre != album_genre";