Lee R Liddick Jr
asked on
SQL query and if statement
In my where statement I need to check two areas, if the first isn't populated, check the other.
if a.C_EFF_DT is NOT NULL then a.C_EFF_DT < date(current date - 6 months)
if a.C_EFF_DT is NULL then b.C_EFF_DT < date(current date - 6 months)
So basically if the first C_EFF_DT is null then check the second C_EFF_DT, if it has a date, then check it and don't worry about the second date.
if a.C_EFF_DT is NOT NULL then a.C_EFF_DT < date(current date - 6 months)
if a.C_EFF_DT is NULL then b.C_EFF_DT < date(current date - 6 months)
So basically if the first C_EFF_DT is null then check the second C_EFF_DT, if it has a date, then check it and don't worry about the second date.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for leerljr68's comment #a39901107
for the following reason:
Accepting own comment since I figured it out myself with no assistance from the other expert comments. Thank you.
Accepted answer: 0 points for leerljr68's comment #a39901107
for the following reason:
Accepting own comment since I figured it out myself with no assistance from the other expert comments. Thank you.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I'm awarding points to those who responded.
ASKER
Even though I answered my own question, I'm awarding points for taking the time to respond. Thank you all.
ASKER