; WITH DateCTE (WeekEnding) AS -- Anchor query to get the first date (SELECT @StartDate AS WeekEnding UNION ALL -- Recursive query to grab the rest of the dates SELECT DateAdd(day,7,WeekEnding) AS WeekEnding FROM DateCTE WHERE WeekEnding < @EndDate ), -- 2nd CTE to grab the list of Vendors VendorListCTE (VendorID) AS (SELECT VendorID FROM Purchasing.PurchaseOrderHeader GROUP BY VendorID)And then I can issue a subsequent query against the Orders table, using DateCTE and VendorListCTE.