Help with SQL to deal with overlapping date range

Analytics

Help with SQL to deal with overlapping date range

Hi,

I have a data set as below. Can someone help me on mergin date range as shown in output.

Promo_id Promo_Start_Date Promo_End_Date

P1            2013-04-01           2013-04-30

P2            2013-04-15           2013-04-30

P3            2013-05-15           2013-05-30

Need Output as this:

Promo_id Promo_Start_Date Promo_End_Date

P1            2013-04-01           2013-04-30

P2            2013-04-01           2013-04-30

P3            2013-05-15           2013-05-30

Thanks,

Raj

Tags (1)
4 REPLIES
KVB
Enthusiast

Re: Help with SQL to deal with overlapping date range

Here ID's are different.How can you say that there are overlapping records.Could you please elaborate your requirement.

Re: Help with SQL to deal with overlapping date range

Date range is overlapping for P1 and P2 so I need to reassign earliest promo start date to both promo ids as below.

Promo_id Promo_Start_Date Promo_End_Date

P1            2013-04-01           2013-04-30

P2            2013-04-01           2013-04-30

Supporter

Re: Help with SQL to deal with overlapping date range

which release are you on?

Re: Help with SQL to deal with overlapping date range

13.1