List:General Discussion« Previous MessageNext Message »
From:Claudio Nanni Date:June 19 2011 6:11pm
Subject:Re: SELECT records less than 15 minutes old
View as plain text  
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-io@stripped>

> 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=1
>
>


-- 
Claudio

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