I get these errors:
Msg 156, Level 15, State 1, Line 22
Incorrect syntax near the keyword 'select'.Msg 102, Level 15, State 1, Line 22
Incorrect syntax near ')'
when running this code:
Select *
from
(select
DWF_Week_No
,DWF_Fuel_Name
,DWF_T_Sale
from
QF_FDashboard_Week_Fuel
where
DWF_Month_Name = 'October'
and DWF_Location_Name = 'Fitzroy') t
pivot
(sum(DWF_T_Sale)
for DWF_Fuel_Name in (select distinct DWF_Fuel_Name from QF_FDashboard_Week_Fuel)
) as pivot_table;