> I know i can compare dates in a mysql table, but i have problems to do a > comand that's compares a date (added by days) whith now(). > > e.g: > Select... ... WHERE (startdate + $days) < now() > > so how i can add $days to the database field startdays and check it with > the now() time ? >
In MySQL (version 3.22+): SELECT ... ... WHERE DATE_ADD(startdate, INTERVAL $days DAY) < NOW() Also (version 3.23+) SELECT ... ... WHERE (startdate + INTERVAL $days DAY) < NOW() If you have other types (month, year, etc.), you can find the proper type to use instead of DAY here: http://www.mysql.com/doc/en/Date_and_time_functions.html HTH. K. Brian Kelley, [EMAIL PROTECTED] Author of Start to Finish Guide to SQL Server Performance Monitoring SQLServerCentral.com Columnist http://www.truthsolutions.com/
