catchingup
Technical User
I am trying to use a nested case statement and am having trouble with the info displaying in the newly created field.
Using the statement below, I am able to run the query, but the information that populates in the new field 'UCFLAG' is incorrect.
It assigns a value of 'NA' to every row in the table,
Any ideas on how to correct this? Any help is much appreciated!!
SELECT #tempComm.Name, #tempComm.Date,
#tempComm.Recd, #tempComm.Cont,
CASE #tempComm.Recd WHEN NULL
THEN (CASE #tempComm.Cont WHEN 'Sub' THEN 'OK'
WHEN 'PO2' THEN 'OK'
WHEN 'Job' THEN 'FLAG'
WHEN 'Open' THEN 'FLAG'
ELSE 'NONE' END)
ELSE 'NA' END AS UCFLAG
FROM #tempComm
Using the statement below, I am able to run the query, but the information that populates in the new field 'UCFLAG' is incorrect.
It assigns a value of 'NA' to every row in the table,
Any ideas on how to correct this? Any help is much appreciated!!
SELECT #tempComm.Name, #tempComm.Date,
#tempComm.Recd, #tempComm.Cont,
CASE #tempComm.Recd WHEN NULL
THEN (CASE #tempComm.Cont WHEN 'Sub' THEN 'OK'
WHEN 'PO2' THEN 'OK'
WHEN 'Job' THEN 'FLAG'
WHEN 'Open' THEN 'FLAG'
ELSE 'NONE' END)
ELSE 'NA' END AS UCFLAG
FROM #tempComm