SELECT Weeks.WeekNum, SUM(sales.quantity) AS sales
FROM Weeks
LEFT JOIN sales
ON Weeks.WeekNum = DATEPART(week, sales.transDate) and
sales.transDate BETWEEN @fromDate AND @toDate
WHERE Weeks.WeekNum BETWEEN DATEPART(week, @fromDate) AND
DATEPART(week, @toDate)
GROUP BY Weeks.WeekNum