SELECT Rank() OVER (ORDER BY receiptdate ) as Firt_Arrival,locationnumber,receiptdate FROM inventorylocsubdetail
Here Rank() fn would return the rank based on the ReceiptDate. But this would be jumbling if there are same rank more than one.
E.g: here rank 4 repeating for three records,because of this the next rank is 7 (4,4,4,7)

|