ML,
>trying to write some SQL that will give me records for the CURRENT WEEK.
>Example, starting on a Sunday and going through Saturday.
>This week it would be Dec 27 - Jan 2.
For the week of any date @d:
... WHERE order_date BETWEEN AddDate(@d, -DayOfWeek(@d)+1) AND
AddDate(@d, 7-DayOfWeek(@d)) ...
PB
-----
ML wrote:
> Hi All,
>
> trying to write some SQL that will give me records for the CURRENT WEEK.
>
> Example, starting on a Sunday and going through Saturday.
> This week it would be Dec 27 - Jan 2.
>
> I am doing this so I can write a query that will show orders that are placed during
> the current week.
>
> Here is what I have, but this is showing from today for the next seven days.
>
> SELECT * FROM orders WHERE WEEK(NOW(), 7) = WEEK(orders.order_date, 7)
> AND DATEDIFF(NOW(),orders.order_date) < 7;
>
> Would anyone have any advice?
>
> -Jason
>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.431 / Virus Database: 270.14.123/2592 - Release Date: 12/29/09 07:47:00
>
>