List:General Discussion« Previous MessageNext Message »
From:sono-io Date:June 19 2011 5:53pm
Subject:SELECT records less than 15 minutes old
View as plain text  
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
Thread
SELECT records less than 15 minutes oldsono-io19 Jun
  • Re: SELECT records less than 15 minutes oldClaudio Nanni19 Jun
    • Re: SELECT records less than 15 minutes oldsono-io19 Jun
      • Re: SELECT records less than 15 minutes oldwalter harms20 Jun
        • RE: SELECT records less than 15 minutes oldJerry Schwartz20 Jun
          • Re: SELECT records less than 15 minutes oldsono-io21 Jun
            • Re: SELECT records less than 15 minutes oldwalter harms21 Jun
            • RE: SELECT records less than 15 minutes oldJerry Schwartz21 Jun