You need to implement a common table expression (CTE). Which code segment should you use?
A.
CREATE VIEW SalesByYear AS
SELECT Year, Region, SUM(OrderTotal)
FROM Orders
GROUP BY Year, Region;
GO
SELECT Year, Region, Total
FROM SalesByYear;
B.
WITH SalesByYear(Year,Region,Total)
AS (SELECT Year, Region, SUM(OrderTotal)
FROM Orders GROUP BY Year,Region)
SELECT Year, Region, Total FROM SalesByYear;
C.
SELECT Year, Region, Total
FROM (
SELECT Year, Region, SUM(OrderTotal) AS Total
FROM Orders
GROUP BY Year, Region) AS [SalesByYear];
D.
SELECT DISTINCT Year, Region, (
SELECT SUM(OrderTotal) FROM Orders SalesByYear
WHERE Orders.Year = SalesByYear.YEAR AND Orders.Region = SalesByYear.Region) AS [Total]
FROM Orders;