gpt4 book ai didi

sql - MySQL JOIN ON 与 WHERE

转载 作者:太空宇宙 更新时间:2023-11-03 10:29:07 25 4
gpt4 key购买 nike

我有2张表,想查询所有加入艺术家的专辑数据

艺术家:artist_id |姓名

相册:album_id |艺术家编号 |歌曲

这只给我第一行

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

关于sql - MySQL JOIN ON 与 WHERE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2289077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com