On 6/28/05, Joseph Harris <[EMAIL PROTECTED]> wrote:
> rudy and Matt,
> 
> Thanks for the answers;   I had been through that page...   ;-(
> 
> CURRENT_DATE won't work for this unless there is a way of putting
> current_date -1 or -2, and I am wanting an automatic check every day for a
> day ahead, which would then initiate emails.
> 
> But this looks as though this might be the basis of what I need (from Matt's
> suggestion)
> 
> SELECT name, email
> FROM foo
> WHERE  DAY()=2 AND MONTH()=03;

If you want names and emails for those with some date at most one day
in the future, you'll want something like this:

SELECT name, email
FROM foo
WHERE somedate <= DATE_ADD(NOW(), INTERVAL 1 DAY);

If you want to make sure that old names and emails don't show up
(although, this is a bit risky, as the names and emails returned
depend on when you are running the script, obviously -- but the
implications of this are that some emails might not get sents, and
some might get sent twice, due to variations of script run time):

SELECT name, email
FROM foo
WHERE somedate BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 DAY);

Whatever you want to do with dates can be done using the functions
listed on the date and time functions page
(http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html).
There's a lot there, but it's all pretty straightforward.

HTH,


-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.

____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
       Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to