RE: [PHP-DB] Retrieve listings between two dates?

From: Date: Thu, 26 Oct 2000 01:23:59 +0000
Subject: RE: [PHP-DB] Retrieve listings between two dates?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-3913@lists.php.net to get a copy of this message
Hi, What datatype is your "Year" column? Is it an Integer or Date/Time type?. If it's Integer then you can do this (My example uses the MySQL Database, Date/Time function) SELECT * FROM Calendar WHERE Year BETWEEN Year('2000-12-31') AND Year('2002-01-01') ORDER BY Start ASC If your column "Year" is date/time then you can do this: SELECT * FROM Calendar WHERE Year(Year) BETWEEN Year('2000-12-31') AND Year('2002-01-01') ORDER BY Start ASC This should work but I haven't tested it :) MySQL Date/time functions http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_and_time_functions > -----Original Message----- > From: Keith Spiller [mailto:larentium@gilanet.com] > Sent: Wednesday, October 25, 2000 3:41 PM > To: php-db@lists.php.net > Subject: [PHP-DB] Retrieve listings between two dates? > > > Using the select command, how would you retrieve listings only between certain dates? > > "SELECT * FROM calendar WHERE Year < '2000-12-31' AND > > '2002-01-01' ORDER BY Start ASC" ??? (This does not work)... > > Is this even possible? > > Keith > > >

« previous php.db (#3913) next »