Just try to give this a go
DECLARE @Table TABLE(
customerName VARCHAR(50),
DateOfOrder DATETIME,
Quantity FLOAT
)
INSERT INTO @Table SELECT 'bobs pizza', '1/5/2010', 10
INSERT INTO @Table SELECT 'bobs pizza', '3/5/2010', 10
INSERT INTO @Table SELECT 'bobs pizza', '3/4/2010', 10
INSERT INTO @Table SELECT 'the phone co','3/5/2010',5
INSERT INTO @Table SELECT 'bobs pizza', '3/12/2010', 3
INSERT INTO @Table SELECT 'the phone co','3/12/2010',11
INSERT INTO @Table SELECT 'the phone co','3/13/2010',11
INSERT INTO @Table SELECT 'the phone co','3/15/2010',11
SELECT DateFirday,
DATENAME(dw, DateFirday),
SUM(Quantity) Total
FROM (
SELECT *,
DATEADD(week, DATEPART(WEEK, DateOfOrder) - 1, CAST('01 Jan' + CAST(DATEPART(year,DateOfOrder) AS VARCHAR(4)) AS DATETIME)) DateFirday
FROM @Table
) sub
GROUP BY DateFirday
Output
DateFirday Total
----------------------- ------------------------------ ----------------------
2010-01-08 00:00:00.000 Friday 10
2010-03-05 00:00:00.000 Friday 25
2010-03-12 00:00:00.000 Friday 25
2010-03-19 00:00:00.000 Friday 11
If I missed something with the Friday dates, let me know so I can have a look.