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关键字
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;