IF function

Hi all,

PFA the structure of my source table, now I want to add new column (OverDue) based the below logic
if (deliquency_date>21 ,"YES","No")
How could I achieve this?
Any suggestions are highly appreciated.

Thanks in advance
TM-Dashboard.xlsx
parpaaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jimyXConnect With a Mentor Commented:
Final:
case when deliquency_date > 21 then "YES" else "No" end
0
 
jimyXCommented:
You can use case:
(case deliquency_date > 21 then "YES" else "No" end)
0
 
jimyXCommented:
Sorry the syntax is:
case deliquency_date when deliquency_date > 21 then "YES" else "No" end
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
parpaaAuthor Commented:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '>'.
0
 
parpaaAuthor Commented:
it was 'Yes'... sorted ..
thanks Jimy
0
 
LowfatspreadCommented:
create view myview
 as select col1,col2,col3,...
   ,case when delinquency_date > 21 then 'yes' else 'no' end as newcolname
from yourtablename


then query myview instead of the table...

or

alter table
add newcolname coalesce(case when delinquency_date > 21 then 'yes' else 'no' end,'no')

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.