Avatar of sam2929
sam2929 asked on

flag record based on range for dates

S_BEGDA    H_BEGDA   S_endda
20100419  20100705   99991231
20031016  20080623   20090331

i want to flag H_BEGDA as Y and other as N on the condition that 20100705 range not between S_BEGDA  and  S_endda while other in between the range

i am doing
Case When H_Begda not BETWEEN S_Begda And S_Endda Then 'Y' Else 'N' End As Test1 both record show me Y

S_BEGDA    H_BEGDA   S_endda  
20100419  20100705   99991231 Y
20031016  20080623   20090331 N
Oracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
slightwv (䄆 Netminder)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

My bad question don't make sense
David VanZandt

This is just an old developer's trick, but I was taught to avoid NOT conditions if the statement could be reworded.  Such as:

Case When H_Begda BETWEEN S_Begda And S_Endda Then 'N' Else 'Y' End As Test1

Is your source data clean enough that you don't need to check for misformatted strings?  Would you ever have, for example, 30131332?  If so, what are the business rules?
slightwv (䄆 Netminder)

>>My bad question don't make sense

As much as I appreciate the points, did I really help you answer you question?

If not and you are going to ask a new question, I suggest we just delete this one.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck