I need to make a query with the ROW_NUMBER() function in order to enumerate all purchase order Lines order by the PurchaseID and date of delivery:
SELECT
PL.PURCHID,
PL.LINENUMBER,
ROW_NUMBER() OVER (PARTITION BY PL.PURCHID
ORDER BY PL.LineNumber, PL.DELIVERYDATE DESC) AS LineNumberOrdered
FROM AXDB13_R1.dbo.PURCHLINE PL
WHERE PL.DATAAREAID = 'pol';
the thing is that the database production is too old that does not recognize that function. How can I emulate that?
thanks a lot for your help!