TSQL: grouping customer orders by week

Posted by fishhead on Stack Overflow See other posts from Stack Overflow or by fishhead
Published on 2010-03-11T23:30:48Z Indexed on 2010/03/12 0:57 UTC
Read the original article Hit count: 280

Filed under:
|

I have a table with a collection of orders. The fields are:

  • customerName (text)
  • DateOfOrder (datetime).

I would like to show totals of orders per week per customer. I would like to have it arranged for the Friday of each week so that it looks like this:

all dates follow mm/dd/yyyy

"bobs pizza", 3/5/2010, 10
"the phone co",3/5/2010,5
"bobs pizza", 3/12/2010, 3
"the phone co",3/12/2010,11

Could somebody please show me how to do this?

Thanks

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server