基本上,每当我尝试运行代码时,它都会在from中给出语法错误
SELECT *
FROM
(SELECT
Tbl_Derived_FMR_Codes.Reason, FMRList_tbl.FLEET,
FMRList_tbl.SUBFLEET, FMRList_tbl.[ACTIVITY DATE],
COUNT(FMRList_tbl.[FMR Reason Derived 1]) AS [CountOfFMR Reason Derived 1]
FROM
Tbl_Derived_FMR_Codes
LEFT JOIN
FMRList_tbl ON Tbl_Derived_FMR_Codes.Reason = FMRList_tbl.[FMR Reason Derived 1]) AS Basedata
PIVOT(
COUNT(ACTIVITY DATE)
for FMRList_tbl in (FMRList_tbl.[ACTIVITY DATE])
) AS PivotTable
GROUP BY Tbl_Derived_FMR_Codes.Reason, FMRList_tbl.FLEET, FMRList_tbl.SUBFLEET, FMRList_tbl.[ACTIVITY DATE]
ORDER BY FMRList_tbl.[ACTIVITY DATE];