Forum Moderators: coopster

Message Too Old, No Replies

Retreive all rows in table that is less than the current date

         

undream2

4:50 am on Mar 11, 2008 (gmt 0)

10+ Year Member



Hi,

I have a date field in mysql with 2008-002-22.

And, I would like to retreive all data in the table that is less than the current data at the time of queries...

I have been messing around with the bottom code.. But, I can't seem to get anything working. Could any of you help?

Thanks.

$result = $connector->query('SELECT * FROM table WHERE 'date' < 'current_date');

undream2

4:56 am on Mar 11, 2008 (gmt 0)

10+ Year Member



the above date has an extra 0. Also, I didn't inlude any functions from the mysql date.

coopster

6:03 pm on Mar 11, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You were close, but you have an error in your syntax.
SELECT * FROM table WHERE `myDate` < CURRENT_DATE