I've this query which runs successfuly
SELECT customerNumber
FROM ORDERS
GROUP BY customerNumber
ORDER BY count(orderNumber) DESC
But when I try to limit the number of rows returned to 1, I get the following error
ORA-00933: SQL command not properly ended
Here's what I've tried :
SELECT customerNumber
FROM ORDERS
GROUP BY customerNumber
ORDER BY count(orderNumber) DESC
fetch first 1 row only;
and
SELECT customerNumber
FROM ORDERS
GROUP BY customerNumber
ORDER BY count(orderNumber) DESC
WHERE ROWNUM=1;
fetch first 1 row only;needs Oracle 12 - which version are you using? Are you trying to find the customer with the most orders?