Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IF function

Posted on 2011-03-23
6
Medium Priority
?
236 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
[X]
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
  • 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 2000 total points
ID: 35196523
Final:
case when deliquency_date > 21 then "YES" else "No" end
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
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 …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 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