2016-09-23 81 views
0

我試圖運行一個查詢,它會將四捨五入的平均值顯示爲兩位小數。這是我的代碼,我不知道爲什麼我不斷收到錯誤。「缺少右括號」MySQL錯誤

SELECT 
    ROUND(AVG (Scholarship, 2)) AS 'Average Scholarships' 
FROM 
    student; 

回答

1
SELECT ROUND(AVG (Scholarship), 2) AS 'Average Scholarships' FROM student; 
3

你傳入Scholarship, 2AVG功能,只期待一個參數。

你的意思做的是通過AVG (Scholarship)2ROUND,像這樣:

SELECT ROUND(AVG (Scholarship), 2) AS 'Average Scholarships' FROM student;