这是我的查询
select tabs.*, count.full_name from (
select noc, medal from olympic_medal_winners
)
pivot(
count(*) for medal in ( 'Gold' gold, 'Silver' silver, 'Bronze' bronze )
) tabs join COUNTRY count on tabs.NOC = count.short_name
order by 2 desc, 3 desc, 4 desc;
它可以找到,这是输出:
我的问题是,为什么将查询更改为:
select tabs.noc, tabs.medal, count.full_name from (
select noc, medal from olympic_medal_winners
)
pivot(
count(*) for medal in ( 'Gold' gold, 'Silver' silver, 'Bronze' bronze )
) tabs join COUNTRY count on tabs.NOC = count.short_name
order by 2 desc, 3 desc, 4 desc;
为什么显示此错误?
ORA-00904: "TABS"."MEDAL": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 10 Column: 18
谢谢。