Use of Dense_Rank() function in Sql(SQL Server,Oracle)

SELECT Dense_Rank() OVER (ORDER BY receiptdate ) as Firt_Arrival,locationnumber,receiptdate
FROM inventorylocsubdetail





Here Dense_Rank() fn would return the rank based on the ReceiptDate. But this would be in sequence even if there are same rank more than one. (This is the major different between Rank() and Dense_Rank())


E.g: here rank 4 repeating for three records,though next rank is 5 (4,4,4,5)

Comments

Popular posts from this blog

SQL SERVER – TRIM() Function – UDF TRIM()