jmwhooper
Posts: 7
|
Posted: 03/18/2004, 8:22 AM |
|
I'm trying to write an sql query which pulls data from 7 days before and 7 days after today.
Something like this:
SELECT * FROM table WHERE date BETWEEN NOW() - 7 OR NOW() + 7
Please help!
|
|
|
Riccardo Novello
|
Posted: 03/18/2004, 9:34 AM |
|
MySQL syntax:
SELECT * FROM table
WHERE ( date >= DATE_SUB(NOW(),INTERVAL 7 DAY) )
AND ( date <= DATE_ADD(NOW(),INTERVAL 7 DAY) )
"jmwhooper" <jmwhooper@forum.codecharge> ha scritto nel messaggio
news:54059ccc13ee5b@news.codecharge.com...
> I'm trying to write an sql query which pulls data from 7 days before
and 7 days after today.
>
> Something like this:
> SELECT * FROM table WHERE date BETWEEN NOW() - 7 OR NOW() + 7
>
> Please help!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
vituskung
|
Posted: 03/19/2004, 12:00 AM |
|
Date manipulation looks horrible for me in php/mysql as an asp programmer.
I would appreciate if anyone can help me on how I can calculate the number of days between 2 date fields.
I tried ($xxx->date1->GetValue() - $xxx->date1->GetValue()) and many other ways and it doesn't work.
|
|
|
vituskung
|
Posted: 03/19/2004, 7:22 AM |
|
I managed to do it with array. Thanks!
|
|
|