2013-09-16 86 views
11
select 
     country_olympic_name, 
     SUM(part_gold) as 'Number of Gold Medals' 
    From 
     games.country, 
     games.participation 
    where 
     participation.country_isocode = country.country_isocode 
    group by 
     country_olympic_name; 

我已經越來越錯誤ORA-00923:FROM關鍵字未找到預期,不知道是什麼原因,請大家幫忙錯誤(ORA-00923:FROM關鍵字未找到預期)

回答

24

標識符需要用雙引號引用(")。單引號(')表示字符(不是「名稱」)。

爲此,你需要使用:

SUM(part_gold) as "Number of Gold Medals" 

更多細節的手冊中:

+0

所有鏈路斷開(甲骨文...) –

+0

@Mr_and_Mrs_D:謝謝,更新。 –

0

你可以試試這樣做: -

select 
    country_olympic_name, 
    SUM(part_gold) as "Number of Gold Medals" 
From 
    games.country, 
    games.participation 
where 
    participation.country_isocode = country.country_isocode 
group by 
    country_olympic_name; 
0

嘗試......

SELECT 
     COUNTRY_OLYMPIC_NAME, 
     SUM (PART_GOLD) AS NUMBER_OF_GOLD_MEDALS 
FROM 
     GAMES.COUNTRY, 
     GAMES.PARTICIPATION 
WHERE 
     PARTICIPATION.COUNTRY_ISOCODE = COUNTRY.COUNTRY_ISOCODE 
GROUP BY 
     COUNTRY_OLYMPIC_NAME; 
+0

這是錯誤的,空間不是問題,問題是,它是一個字符串,而不是一個標識符。 – miracle173

相關問題