Skip to content
Advertisement

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] 

Advertisement

Answer

CASE WHEN R.S = 'Clogged' Then 'Pending' ELSE R.Final END as [Result] 
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement