parpaa
asked on
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
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
Sorry the syntax is:
case deliquency_date when deliquency_date > 21 then "YES" else "No" end
case deliquency_date when deliquency_date > 21 then "YES" else "No" end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '>'.
Incorrect syntax near '>'.
ASKER
it was 'Yes'... sorted ..
thanks Jimy
thanks Jimy
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')
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')
(case deliquency_date > 21 then "YES" else "No" end)