Hello Experts,
I am fairly new to Teradata and need help to sort my issue.
I have a scenario where one line item has multiple status_codes. there is a hierarchy preference set for these status_codes to pick just one.
I have to use a Case statement(i think) to pick the appropriate Status_code for a given line item
Current situation: there is a one to many relationship between LINE ITEM and STATUS CODE
FIX: I have to get a ONE to ONE relationship between LINE_ITEM and STATUS_CODE. i.e if one line_item is assigned to multiple codes then pick the highest rank code in hierarchy.
EXAMPLE:
LINE_ITEM STATUS_CODE
1234 A
1234 U
456 G
1234 F
567 A
HIERARCHY given by business:
Rank Status_code
- A
- U
- 1
- G
- F
- E
- L
- C
I would greatly appreciate for a quick solution.
Thanks,
AM