select *
from amazon_shipment, customer
where amazon_shipment.customer_id = customer.customer_id
and amazon_shipment.customer_id in
(select top(1) amazon_shipment.customer_id
from amazon_shipment
group by amazon_shipment.customer_id
order by count(*) desc);
我试图选择所有订单最多的客户,但是,我得到一个错误:
未找到FROM关键字
答案 0 :(得分:0)
TOP(1)在Oracle中不可用。
在Oracle 11gR2及更低版本中,您可以使用WHERE ROWNUM <2
select *
from EMPLOYEES
where rownum < 2
order by SALARY desc;
在Oracle 12c和更高版本中,您只能使用FETCH FIRST 1 ROWS
select *
from EMPLOYEES
order by SALARY desc
fetch first 1 rows only;