我使用SQL Fiddle进行小批量测试但是当我将整个数据集输入oracle时会导致SQL错误:ORA-00979:不是GROUP BY表达式。
Select Staff.Number, Staff.Name, Staff.title, Staff.S_Location,
count(Contact.Number) as X
from Staff
left join Contact
on Staff.Number = Contact.Number
group by Staff.Number
order by X desc;
答案 0 :(得分:2)
您需要通过
将Staff.Name,Staff.Title和Staff.S_Location添加到组中