0

I'm having a hard time finding correct syntax to do the following:

SELECT
ColumnA,
ColumnB,
ColumnC,
(if Column1 IS Null and Column2 IS NOT NULL) Then 'Pending' Else '' AS ColumnD

I've tried IF/ELSE, IIF(), but I can't seem to get these queries to work.

1 Answer 1

2

use case when expression

SELECT ColumnA,ColumnB,ColumnC,
case when Column1 IS Null and Column2 IS NOT NULL Then 'Pending' Else '' end AS ColumnD 
from yourtable
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.