List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 10 2002 2:22am
Subject:Re: DATES & Optimization
View as plain text  
At 9:02 -0600 1/9/02, Robert L. Yelvington wrote:
>Two quick qux for the gurus on the list!
>
>1. If I needed to do date calculations based upon a TIME STAMP field, what's
>the most efficient way to accomplish this with respect to data types (field
>types...I already understand how to use the DATE functions and am aware of
>locale time and UNIX time trappings)?  For example, someone signs up on a
>mailing list via mysql data base, and then I want to know how many people
>have signed up in Jan, 2001 or March, 1999 or Jan, 2002?  OR, another

Jan, 2001:
SELECT COUNT(*) FROM tbl_name WERE MONTH(t) = 1 AND YEAR(t) = 2001;
Others are similar.

>example, someone signs up and I want to calculate 4 ninety day cycles with a
>reminder sixty days from sign up, so that if I signed up on Jan 1, 2002 then
>on Mar 1, 2002, I'd like to send notification that their account needs
>maintenance by April 1, 2002...kinda like a billing system.

Use DATE_ADD().

Thread
DATES & OptimizationRobert L. Yelvington9 Jan
  • Re: DATES & OptimizationPaul DuBois10 Jan
    • Re: DATES & OptimizationPaul DuBois10 Jan
    • RE: DATES & OptimizationRobert L. Yelvington11 Jan