Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

IF function

Posted on 2011-03-23
6
231 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:parpaa
  • 3
  • 2
6 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 35196501
You can use case:
(case deliquency_date > 21 then "YES" else "No" end)
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35196517
Sorry the syntax is:
case deliquency_date when deliquency_date > 21 then "YES" else "No" end
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 35196523
Final:
case when deliquency_date > 21 then "YES" else "No" end
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:parpaa
ID: 35196529
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '>'.
0
 

Author Comment

by:parpaa
ID: 35196536
it was 'Yes'... sorted ..
thanks Jimy
0
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 35196591
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

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question