Re: MySql and displaying only yesterday's records

From: Date: Mon, 21 Oct 2002 14:07:27 +0000
Subject: Re: MySql and displaying only yesterday's records
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-22547@lists.php.net to get a copy of this message
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 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... > >

« previous php.db (#22547) next »