Need Help with a SQL

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Enthusiast

Need Help with a SQL

Hi Gurus,

 

Can you please help me the SQL logic for the below senario,  DATE1 and DATE2 are two columns in my table and DATE3 is the execpted output. 

 

DATE 1 DATE 2DATE3 Expected output
2017-02-182016-10-11Null
2017-01-232017-01-132017-02-18
2017-01-232017-01-212017-02-18
2017-01-232017-01-232017-02-18
2017-01-232017-01-242017-02-18
2017-02-042017-01-272017-01-23
2017-02-042017-01-302017-01-23
2017-02-042017-02-032017-01-23
2017-02-112017-02-042017-02-04
2017-02-112017-02-102017-02-04
2017-02-182017-02-112017-02-11
2017-02-182017-02-132017-02-11
2017-02-182017-02-172017-02-11
2017-02-182017-02-182017-02-11
2017-02-182017-02-192017-02-11
2017-02-182017-02-282017-02-11
2017-02-182017-03-272017-02-11
2017-02-182017-03-282017-02-11

 

Thanks .

 

2 REPLIES
Enthusiast

Re: Need Help with a SQL

I dont think it is possible in 1 statement.. is the data ordering correct for DATE1 column? what I see is 1st value & Last value of DATE1 are equal which are not sorted that's complicating logic...If data is not correct, please provide right set.

Enthusiast

Re: Need Help with a SQL

 
Tags (1)