Query all records ordered by date but no knewer than today's

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
3dron
Forum Commoner
Posts: 40
Joined: Sat Feb 01, 2003 10:25 pm

Query all records ordered by date but no knewer than today's

Post by 3dron »

I have dates stores in format 0000-00-00

How do I query dates only older or equal to today's date?

Something like this:

"where date =< date()" ???

Thanks

Ron
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You could do:

Code: Select all

SELECT field1, field2, field3 FROM table WHERE date <= CURDATE()
http://www.mysql.com/doc/en/Date_and_ti ... tions.html

Mac
3dron
Forum Commoner
Posts: 40
Joined: Sat Feb 01, 2003 10:25 pm

Post by 3dron »

Great, it worked like a charm!!!
Post Reply