Page 1 of 1

How do I get data from mysql based on week number?

Posted: Mon Oct 21, 2002 6:48 am
by Blade
I want to extract data from a mysql table based on week numbers.

something like this: select * from table where (date = week 42)

I know how to do it in php, but I there is no need to load the whole database into memory, when I know it can be done with a simple sql statement. I just dont know how, so can some kind person please show me how?

Posted: Mon Oct 21, 2002 7:18 am
by twigletmac
http://www.mysql.com/doc/en/Date_and_ti ... tions.html

Maybe something like:

Code: Select all

SELECT field1, field2, field3, date FROM table WHERE WEEK(date) = 42
Mac

Posted: Mon Oct 21, 2002 7:49 am
by Blade
Thats it :)

Thanks a lot. I did look at the mysql page before, but I didnt really understand how to use the info until now.