At 11:02 -0400 9/27/03, Bruce Therrien wrote:
Using a select statement, how does one
select all records that have a date one day
less than the current date? Searching the archives
and I can't seem to find the answer......

Our database has these fields:

EMAIL, AMOUNT, ID, DATE

The date is in format 00/00/0000

If your dates were stored in a DATE column, you could write your query like this:

... WHERE DATE = DATE_SUB(CURDATE(),INTERVAL 1 DAY)

However, if your dates are in 00/00/0000, then I suppose they are stored
in a string column.  In this case, you'll have to figure out what
yesterday's date is, then convert it to a string in the same format your
"dates" are stored so that you can perform the comparison.

Is there some reason you're not storing your "dates" in a DATE column?


-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to