我有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

最佳答案

WHEREJOIN之后:

SELECT  *
FROM    albums
JOIN    artists
ON      artists.artist_id = albums.artist_id
WHERE   album_id = 101

10-05 19:31