• MMartin1 - Wednesday, April 11, 2018 10:24 PM

    Luis has the answer for you. Just also be aware of the risk with hard coding values in the SQL code. It may be a good idea to have a table that represents these different states (DISP, EXP) with a accompanying ID column. 
    In your code you can join to this 'status' table and join on the ID . No need for case statments.

     
    Select t1.statusID , t2.statusName
    FROM myBaseTable t1
    JOIN myStatusTable t2
    ON t1.statusID=t2.statusID

    THat way if later your status name get s a better name (disp --> displaced) for clarity you dont need to change anything in your code

    Just be aware that such a table will need maintenance to be sure that new values are added as needed.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)