troubleshooting Question

How to properly use an IIF statement with multiple criterion?

Avatar of Derek_Indianapolis
Derek_Indianapolis asked on
SQL
2 Comments1 Solution228 ViewsLast Modified:
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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros