Near out dates compared to Current date based on input dates

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.

Near out dates compared to Current date based on input dates

Hello Experts ,

 

I have a requirement which is little beyond my thoughts, I would need your help in forming an SQl.

 

I have a input data (Effective and Expiration dates) which is getting compared with Current date.

 

Let say if EXP_DATE > Current date then we are taking EFF_DATE dates and adding Years/Months to get nearest year which is not greater than current date.

(Ex : If EFF_DATE is already near then we are not adding any year/months.
if EFF_DATE is already near is 3 years/Months before to current dates the we are adding 3 years/Months to Eff_date to get the nearest value)
and if EXP_DATE < Current date then we are taking EFF_DATE date and loading it to output and to get the end date, we are looking at the Freq and qualifier and adding years/months accordingly.

 

Giving you some sample out put values which are expected.

Capture.PNG

 

Thank you so much in Advance

1 REPLY
Highlighted
Teradata Employee

Re: Near out dates compared to Current date based on input dates

Hi akavarambhanu01,

 

 

Look into the following thread, logic seems almost the same :

https://community.teradata.com/t5/General/Calculating-start-and-end-date-based-on-frequency-and-star...