For a single id column, we have sequence number 01, 02, 03 upto 99 repeating twice /thrice.
Example:
ID SEQ_NO
----------
2 01
2 02
2 03
.
.
.
2 99
2 01
2 02
2 99
We have a requirement to add AA prefix to second time when it is looping on seq_no, and for third time it should be BB.
Can anyone explain how to do this?
Try the following using the
ROW_NUMBERfunction:If you want only to select SEQ_NO as a new column:
If you want to update the SEQ_NO column:
See a demo with a set of data where seq (01 - 10) is repeated three times.