I need to have row numbering where the ROW_NUMBER is the same for same value column: MFGPN (Same MFGPN will always be in sequence). I also need to maintain the original sequence by No.
Here's my table
No MFGPN
1 Z363700Z01
2 Z363700Z01
3 0119-960-1
4 1A3F1-0503-01
I tried using RANK() to achieve the desired but am running into trouble.
SELECT RANK() OVER(ORDER BY MFGPN) As [Item], MFGPN FROM Table1 ORDER BY [No] ASC
RESULT
Item MFGPN Desired Result
3 Z363700Z01 1
3 Z363700Z01 1
1 0119-960-1 2
2 1A3F1-0503-01 3
Appreciate you guys' expert advise. Thanks!