"Shaun" <[EMAIL PROTECTED]> wrote on 09/06/2005 03:47:25 PM:

> Hi,
> 
> Given two dates, can Mysql calculate and return all the dates that occur 

> between them?
> 
> Thanks for your advice. 
> 
> 
> 

Given any two dates, MySQL can tell if a third date is within that range. 
That's easy.

To actually return a list of all dates between any arbitrary pair of dates 
requires some form of loop (v5.0+) or a lookup into a table populated with 
all possible dates (any version that supports joins). It's possible to get 
MySQL to give you a list of dates but not as a "native" function. There is 
just no facility built into the system to return that list. Sorry!  Have 
you seen such a function before? If so, where and what was it called?

Most of the times when people ask this question, they have a report they 
want to write and need to generate "blank" rows for dates that aren't in 
the data. Is that what you need or is there some other purpose to your 
question?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to