MySQL Forums
Forum List  »  Newbie

Looping Over a Series of Dates
Posted by: Ryan Klockner
Date: July 12, 2018 11:54AM

I have a table that contains a list of start and end dates. Let's call it dateTable. It contains id, startDate, and endDate.

I need to write a query, that based on this single record, will return a record for every 28 days.

Example: a record has a startDate of 10/8/2018 and an endDate of 12/2/2018

It should return two results.

One with a date of 10/8/2018 and one with a date of 11/5/2018 (28 days later). *These dates should be calculated based on days from the start date (0 days, then 28 days, then 56 days, etc.).

I need to process this as a part of the query and cannot use PHP or Excel or any other non-MySql methods.

Options: ReplyQuote


Subject
Written By
Posted
Looping Over a Series of Dates
July 12, 2018 11:54AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.