> I have created a sql statement that enables me to select all entries in > to MySQL that are dated today, I am trying to do the same for all items > that are now one day old and also two days old etc > > I am doing this: > > SELECT * > FROM table > WHERE category = 3 AND show = 1 AND date = NOW()-1 > > I have it working for todays records, it filters out any that don't > match todays date or NOW(), but it still returns the same records for > NOW()-1, or NOW()-2. I have tried DATE() but this gives me an error. > > What is the correct syntax for what I am trying to achieve? >
Assuming the field "date" is of type datetime: WHERE (TO_DAYS(CURDATE()) - TO_DAYS(date)) = 1 HTH -- Lowell Allen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]