just a quick debug: SELECT time_stamp,DATE_SUB(NOW(), INTERVAL 15 MINUTE) FROM `records` WHERE `order_id` = $order_id order by time_stamp desc limit 10;
what do you get? 2011/6/19 <sono...@fannullone.us> > Hi, > > I'm trying to write a statement that will return all records that > match a particular order_id and that have a timestamp within the last 15 > minutes. I thought that this should work: > > SELECT * FROM `records` WHERE `order_id` = $order_id AND (`time_stamp` >= > DATE_SUB(NOW(), INTERVAL 15 MINUTE)) > > but it returns zero rows, no matter what. If I up the interval to > something huge, like 15000, it will then return records. Very strange. > It's almost like it's using seconds, not minutes. > > Is my syntax wrong? > > Thanks, > Marc > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/mysql?unsub=claudio.na...@gmail.com > > -- Claudio