wadewilson1
Programmer
I'm trying to create a new column derived from another column and I am having trouble doing it.
I have column 1 that can be 1,2, or null, if it is 1 I want it to display A, if 2 then B if null, then display column 3. I tried the following code, but it doesn't work at (not surprising)
SELECT DISTINCTROW PEOPLESOFT_ID, Department, CategoryText, ProductID, TotalRawScore, TotalRawGoal IIf([productid] = '1', (IIf([department] <> 'Lost Stolen', '', [department]), IIf([productid] = '2', IIf(([department] = 'Lost Stolen' OR [Department] = 'Fraud Detection'), [department], ''), [department]))) AS DepartmentEx
FROM dbo.VW_QASCORES_EXCLUDE
I have column 1 that can be 1,2, or null, if it is 1 I want it to display A, if 2 then B if null, then display column 3. I tried the following code, but it doesn't work at (not surprising)
SELECT DISTINCTROW PEOPLESOFT_ID, Department, CategoryText, ProductID, TotalRawScore, TotalRawGoal IIf([productid] = '1', (IIf([department] <> 'Lost Stolen', '', [department]), IIf([productid] = '2', IIf(([department] = 'Lost Stolen' OR [Department] = 'Fraud Detection'), [department], ''), [department]))) AS DepartmentEx
FROM dbo.VW_QASCORES_EXCLUDE