I have this code in sql:
SELECT DISTINCT
O.custid,
P.productname,
TO_CHAR(MAX((quantity) * D.unitprice) AS "Revenue"
FROM corp.Orders O
LEFT JOIN corp.Order_Details D ON O.orderid = D.orderid
LEFT JOIN corp.Products P ON D.productid = P.productid
GROUP BY O.custid, P.productname
HAVING P.productname = 'Ctte de Blaye'
ORDER BY MAX(quantity) * D.unitprice DESC;
this returns
CUSTID Productname revenue QUICK Ctte de Blaye 15810 HANAR Ctte de Blaye 15810 PICCO Ctte de Blaye 10540 RATTC Ctte de Blaye 10540 SIMOB Ctte de Blaye 10540 MEREP Ctte de Blaye 10329.2 QUEEN Ctte de Blaye 8432 KOENE Ctte de Blaye 7905 GREAL Ctte de Blaye 7905 WHITC Ctte de Blaye 6587.5 SPLIR Ctte de Blaye 4216 ERNSH Ctte de Blaye 4216 BERGS Ctte de Blaye 3952.5 TORTU Ctte de Blaye 3952.5 THEBI Ctte de Blaye 2635 SANTG Ctte de Blaye 2108 BLONP Ctte de Blaye 2108 SPECD Ctte de Blaye 1317.5 RANCH Ctte de Blaye 527
I NEED TO KNOW HOW TO GET THIS ONLY RETURN THE FIRST 2 ROWS!