From: Claudio Nanni Date: June 19 2011 6:11pm Subject: Re: SELECT records less than 15 minutes old List-Archive: http://lists.mysql.com/mysql/225300 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf307f35fad0ab4304a6148bde --20cf307f35fad0ab4304a6148bde Content-Type: text/plain; charset=ISO-8859-1 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 > 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.nanni@stripped > > -- Claudio --20cf307f35fad0ab4304a6148bde--