List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 2 1999 8:24pm
Subject:DATES
View as plain text  
>>>>> "ATS" == ATS  <urb@stripped> writes:

ATS> 	I have three questions about dates.
ATS> !. If date of birth is stored in a DATE field format
ATS> of 1952-12-31, what is the most efficient way to
ATS> develop the persons's age?

year(now()) - year(birth) + if(right(now(),5) >= right(birth,5),1,0) as age
 
ATS> 2. If a date is stared as above for a field, 
ATS> DateOfLastPurchase, what is the most efficient 
ATS> way to develop days since last purchase.

to_days(now()) - to_days (DateOfLastPurchase)

ATS> 3. Where is the best place to find one for
ATS> Saturday night? (It's a joke!)

select * from best_places_on_earth order by rank desc limit 1

Regards,
Monty
Thread
DATES(ATS)2 Sep
  • Re: DATESMartin Ramsch2 Sep
  • DATESMichael Widenius3 Sep
    • Re: DATES(ATS)3 Sep
      • Re: DATES(ATS)3 Sep
        • Re: DATESMartin Ramsch3 Sep