List:General Discussion« Previous MessageNext Message »
From:ML Date:December 29 2009 12:14am
Subject:Weeks
View as plain text  
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

Thread
WeeksML29 Dec
  • RE: WeeksGavin Towey29 Dec
  • Re: WeeksPeter Brawley29 Dec
  • Re: WeeksDaWiz30 Dec