Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/151.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 从数据库中选择相册的名称和数量_Mysql_Database - Fatal编程技术网

Mysql 从数据库中选择相册的名称和数量

Mysql 从数据库中选择相册的名称和数量,mysql,database,Mysql,Database,我有以下数据库(),我想选择艺术家的名字和艺术家录制的专辑数量,但每次我运行代码时,它都会显示第一个名字和专辑总数 这是我的代码: SELECT Name, count(*) FROM album INNER JOIN artist ON album.ArtistId = artist.ArtistId; 使用分组依据 SELECT Name, count(*) FROM album INNER JOIN artist ON album.ArtistId = artist.ArtistId;

我有以下数据库(),我想选择艺术家的名字和艺术家录制的专辑数量,但每次我运行代码时,它都会显示第一个名字和专辑总数

这是我的代码:

SELECT Name, count(*)
FROM album
INNER JOIN artist
ON album.ArtistId = artist.ArtistId;

使用
分组依据

SELECT Name, count(*)
FROM album
INNER JOIN artist ON album.ArtistId = artist.ArtistId;
GROUP BY Name

非常感谢你。