SQL query - CASE command????
I am fairly new to SQL and can't seem to figure this out. I'm trying to run a query in query analyzer that compares two fields and depending on the content changes the value of one at run time.
Both fields exist in the same record and both criteria must be met to qualify for the change of the NAME field to VACANT. Otherwise nothing changes.
I wasn't sure if I had to use a Go and a select or not. Yeah - I'm really that new to SQL!!!
WHEN REG_TEMP='R' AND NAME=' ' (I've also considered the IS NULL option here!)
THEN NAME = 'VACANT' (I didn't think I needed an else as the else would be to leave it be!)
A collegue told me to use the CASE command as that usually works. It seems simple enough with one field at a time but with the two I'm lost.
If I've left out info that is required to help me please let me know.