gpt4 book ai didi

mysql - 错误代码 1248,SQL 状态 42000 : Every derived table must have its own alias

转载 作者:行者123 更新时间:2023-11-29 22:35:24 30 4
gpt4 key购买 nike

我正在 MySQL 上运行此查询。

Select Vendor, sum(Rate) as Rate
from (select case Vendor when 'NSN' then 'Nokia' else Vendor end as Vendor, Rate
from ( Select vendor ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '2015-01-01'and'2015-01-30') as Rate from incident where open_time between '2015-01-01'and'2015-01-30'group by upper (vendor) )) as y group by vendor;

它给出了这个错误:

Error code 1248, SQL state 42000: Every derived table must have its own alias".

有什么问题吗?

最佳答案

您忘记为内部子查询指定别名。我选择了x

Select Vendor, sum(Rate) as Rate
from
(
select case Vendor when 'NSN' then 'Nokia' else Vendor end as Vendor, Rate
from
(
Select vendor ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '2015-01-01'and'2015-01-30') as Rate
from incident
where open_time between '2015-01-01'and'2015-01-30'
group by upper (vendor)
) as x
) as y
group by vendor;

关于mysql - 错误代码 1248,SQL 状态 42000 : Every derived table must have its own alias,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29566030/

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