1. 程式人生 > >[Err] 1111 - Invalid use of group function

[Err] 1111 - Invalid use of group function

這句話的意思是說集函式用法無效

我的SQL語句是:

SELECT s.student_id,s.student_name FROM student s,score sc WHERE s.student_id =sc.student_id AND COUNT(s.student_id)

當我執行到這裡的時候就丟擲了這個異常

把SQL語句改成:

SELECT s.student_id,s.student_name FROM student s,score sc WHERE s.student_id =sc.student_id GROUP BY s.student_id HAVING COUNT(s.student_id)

問題解決了