[PHP-DB] Re: Date Select

2004-06-25 Thread Torsten Roehr
Tom Chubb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 How can I query a MySQL table to get the latest results from a date field?
 Basically, I am inserting several records at a time at the end of each
week.
 I want to have a page that displays the results for the last week only.
 The date format in the field is -MM-DD

Please go to the mysql.com website, search for date and you'll find a
detailed description of how to query date columns.

Regards, Torsten Roehr

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Date Select

2004-06-25 Thread pete M
select * from table where week(date_field) = ( week(now()) -1 )
Tom Chubb wrote:
How can I query a MySQL table to get the latest results from a date field?
Basically, I am inserting several records at a time at the end of each week.
I want to have a page that displays the results for the last week only.
The date format in the field is -MM-DD
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Date Select

2004-06-25 Thread Gerben
select * from table where TO_DAYS(date_field)  ( TO_DAYS(NOW()) -7 )

this will give the entries of the last 7 days (and the ones that are in the
future)

Tom Chubb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 How can I query a MySQL table to get the latest results from a date field?
 Basically, I am inserting several records at a time at the end of each
week.
 I want to have a page that displays the results for the last week only.
 The date format in the field is -MM-DD


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php