-1

I have two dates (start_date and end_date). I am trying to create one record for each month between those two dates.

As an example:

start_date= 01/01/2016
end_date=23/04/2016

Output:

Period
2016-01-31
2016-02-28
2016-03-31
2016-04-30

I am fairly new to mysql and not sure how to achieve that. Could you please give me some ideas?

thanks

Bogdan Bogdanov
  • 1,707
  • 2
  • 20
  • 31
Harold
  • 23
  • 1
  • 6

1 Answers1

0
 select Date_Sub(Date_Add('2015/01/01',INTERVAL 1 Month),INTERVAL 1 Day)

I guess you want to print end date of month between two intervals, Use above statement in your loop.

superB
  • 288
  • 2
  • 13