Brad
Brad

Reputation: 1480

SQL Server case based off of another column

How could I go about using a case statement to set column final, based on column S?

The objective is to use any record that has a final, and also include any records from column S only if S = 'Clogged' and set final to 'pending'.

CASE R.S When 'Clogged' Then 'Pending' as [Result] ELSE R.Final as [Result] End

CASE R.FINAL WHEN R.S = 'CLogged' Then 'Pending' ELSE R.Final END  as [Result] 

Upvotes: 0

Views: 35

Answers (1)

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171421

CASE WHEN R.S = 'Clogged' Then 'Pending' ELSE R.Final END as [Result] 

Upvotes: 1

Related Questions