gpt4 book ai didi

mysql - musicbrainz 无法按国家/地区统计艺术家

转载 作者:行者123 更新时间:2023-11-29 05:58:15 27 4
gpt4 key购买 nike

您好,我正在使用 musicbrainz 数据库,我无法计算每个国家/地区的所有艺术家,但无论我尝试哪个国家/地区,我都会遇到同样的错误,即使我尝试使用 like。请任何人告诉我我做错了什么?

ERROR: column "%u%" does not exist LINE 7: WHERE AREA.NAME LIKE "%u%"

SELECT COUNT(artist.name)
FROM artist
JOIN area ON artist.area = area.id
JOIN label ON area.id = label.area
JOIN country_area ON area.id = country_area.area
JOIN release_country ON country_area.area = release_country.country
WHERE AREA.NAME LIKE "%dom"
GROUP BY release_country.country
limit 5;

更新:

musicbrainz_db=> SELECT COUNT(artist.name)
musicbrainz_db-> FROM artist
musicbrainz_db-> JOIN area ON artist.area = area.id
musicbrainz_db-> JOIN label ON area.id = label.area
musicbrainz_db-> JOIN country_area ON area.id = country_area.area
musicbrainz_db-> JOIN release_country ON country_area.area =
release_country.country
musicbrainz_db-> WHERE AREA.NAME LIKE '%dom'
musicbrainz_db-> GROUP BY release_country.country
musicbrainz_db-> limit 5;

ERROR: canceling statement due to statement timeout

我的老师刚过来说没有子查询就不行?

select area.name, label_count
from area
where label_count in
(
select area.name, count(label.id) as "label_count"
from area
JOIN label on area.id = label.area
group by area.name
);

子查询工作正常但主查询失败?知道为什么。

最佳答案

SELECT COUNT(artist.name)
FROM artist
JOIN area ON artist.area = area.id
JOIN label ON area.id = label.area
JOIN country_area ON area.id = country_area.area
JOIN release_country ON country_area.area = release_country.country
WHERE AREA.NAME LIKE '%u%'
GROUP BY release_country.country
limit 5;

关于mysql - musicbrainz 无法按国家/地区统计艺术家,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47393677/

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