我有2张桌子,想要查询与艺术家一起加入的所有专辑数据
artists: artist_id | name
albums: album_id | artist_id | songs
这只给了我第一行
SELECT * FROM albums JOIN artists ON artists.artist_id = albums.artist_id
我想指定一个专辑ID
SELECT * FROM albums
WHERE album_id = 101
JOIN artists ON artists.artist_id = albums.artist_id
答案 0 :(得分:5)
WHERE
追踪JOIN
:
SELECT *
FROM albums
JOIN artists
ON artists.artist_id = albums.artist_id
WHERE album_id = 101