I have a table (MySQL) data that stores a bunch of signup information.
What I'm trying to do it calculate whether a row's creation has been 12 hours or not.
For each row I have a cell called "date" which displays like this:
July 13, 2011 19:28 or August 7, 2011 03:33
I'm looking for a simple if/else statement that picks up on whether "date" h开发者_JAVA技巧as been 12 hours since its creation or not.
SELECT ...
FROM yourtable
WHERE `date` <= DATE_SUB(now(), INTERVAL 12 HOUR)
note that naming your field 'date' is bad practice. Date is a reserved word in MySQL, and reserved words should NOT be used as field names.
精彩评论