【发布时间】:2015-05-18 11:42:52
【问题描述】:
我目前正在尝试回答以下问题:
显示从 Archie’s Luxury Motors 购买汽车最多的客户的姓名。
我正在使用的表:
客户
(custID, name, DOB, streetAddress, suburb, postcode,
gender, phoneNo, email, type)
销售交易
(VIN, custID, agentID, dateOfSale, agreedPrice)
我尝试了以下查询:
select customer.name
from customer, salestransaction
where customer.custid = salestransaction.custid
group by (salestransaction.custid)
having count(salestransaction.custid) = max(salestransaction.custid);
我收到以下错误:
ORA-00979: not a GROUP BY expression
请告诉我我做错了什么。
【问题讨论】:
-
请发布一些示例数据。