View Single Post

   
  #5 (permalink)  
Old 02-28-2008, 10:32 AM
Carolyn Marenger
 
Posts: n/a
Default Re: pulling upcoming dates

Luuk wrote:
> "Carolyn Marenger" <cajunk@marenger.com> schreef in bericht
> news:44b9a$47a078eb$cf70133e$2109@PRIMUS.CA...
>> Kim wrote:
>>> On Jan 29, 11:31 pm, Carolyn Marenger <caj...@marenger.com> wrote:
>>>> How do I perform a select statement that would locate all records in
>>>> which the day and month are in the next say 30 days regardless of the
>>>> year. Basically an upcoming birthday/anniversary list.
>>>>
>>>> Thanks, Carolyn
>>> Have a look at the function date_sub(), and you find more date
>>> functions here
>>> http://dev.mysql.com/doc/refman/5.1/...functions.html.

>> I don't think I can use date_sub() for it, but extract looks like it a
>> close match to my needs.
>>
>> Carolyn

>
> select now(), date_add(now(), INTERVAL 30 DAY);
> or
> select now(), date_sub(now(), INTERVAL -30 DAY);
>
> gives:
> 2008-01-30 14:38:29 2008-02-29 14:38:29
>
>
> i think this will be easier than the extract function ?
>


That gives me dates for this year, but I want to get a listing of all
people with birthdays in the next 30 days. So, today being January
30th, I want a listing of all people with birthdays from today, 01-30 to
03-02 for ALL years, not just the current year.

As I understood date_add(), it would only give me people born today and
in the next 30 days. Am I mistaken?
Reply With Quote