A cláusula where
WHERE (sales.transDate BETWEEN @fromDate AND @toDate)
removerá todas as semanas sem vendas. Você provavelmente precisará fazer uma subconsulta para extrair as transações e depois juntá-las à sua tabela de semanas. SELECT Weeks.WeekNum, SUM(sales.quantity) AS sales
FROM Weeks LEFT OUTER JOIN
(
SELECT *
FROM sales
WHERE (sales.transDate BETWEEN @fromDate AND @toDate)
) sales
ON Weeks.WeekNum = DATEPART(week, sales.transDate)
GROUP BY Weeks.WeekNum