Derek_Indianapolis
asked on
How to properly use an IIF statement with multiple criterion?
I would like to write an IIF statement that converts the example query:
Location Count
DN01 00 01 4
DN01 00 02 5
DN02 00 01 4
DW01 00 01 3
DW01 00 02 1
DW02 00 02 4
DW03 00 01 1
To convert the previous example to this:
Location Count
NA10 4
NA10 2
WA01 3
WA01 1
WA02 4
Basically, Everytime it shows a DN change to NA, Everytime it shows a DW change to WA. Then also I only want to see the left 4 places after the text replacements take place. I only have read access to the host data system, so I can not change the locations in the system.
Location Count
DN01 00 01 4
DN01 00 02 5
DN02 00 01 4
DW01 00 01 3
DW01 00 02 1
DW02 00 02 4
DW03 00 01 1
To convert the previous example to this:
Location Count
NA10 4
NA10 2
WA01 3
WA01 1
WA02 4
Basically, Everytime it shows a DN change to NA, Everytime it shows a DW change to WA. Then also I only want to see the left 4 places after the text replacements take place. I only have read access to the host data system, so I can not change the locations in the system.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
left(replace(replace(Locat
from <TableName>