Re: MySql and displaying only yesterday's records

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

 



TO_DAYS() applied on datetime field is returning different values on
different times but same date!

How can I pass to TO_DAYS() only the DATE part of my datetime field?

Elias,

"John W. Holmes" <holmes072000@charter.net> wrote in message
000501c278ff$b9c4ef00$7c02a8c0@coconut">news:000501c278ff$b9c4ef00$7c02a8c0@coconut...
> > Given a datetime field in a MySql database, how can i list all the
> records
> > that are dated back to yesterday or to 'N' days in the past?
>
> SELECT * FROM your_table WHERE TO_DAYS(date_column) =
> TO_DAYS(CURRENT_DATE) - N
>
> Where N is how many days you want to go back.
>
> ---John Holmes...
>
>



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