Re: Date and a few days query help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



what need is the mysql TO_DAYS() function. see below (from the mysql
manual):

SELECT something FROM tbl_name WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <=
2;

The '2' is the number of days you want to go back.

-Jake


"Lewis Watson" <php@visionsix.com> wrote in message
003a01c31020$cf4f8980$a977ca41@vsis169">news:003a01c31020$cf4f8980$a977ca41@vsis169...
> I have a table where one of the columns has a date time field. I am rtying
> to build a query that will pull all results between the current date and
> up to 48 hours (2 days) ago. I have tried various queries using examples
> like below...
>
> select * from calls where (event_date_time >= curDate())
>
> select curdate() + 36
>
> select * from calls where SUBDATE(CURDATE(), INTERVAL - 2 DAY)
>
> SELECT * from calls where event_date_time = 'curdate()' - INTERVAL 1
> SECOND
>
> I just can't get the syntax right ( or the concept :-) Please help.
> Thanks.
> Lewis
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux