我正在尝试修改 MS 查询中的 SQL,并且在我提交此代码时返回标题中的错误。在这种情况下,AS 有什么问题?我可以尝试在其他地方执行此操作,但如果我可以让 Query 工作,那将是最简单的。谢谢 *或者有没有办法改进代码以便不需要 AS?
SELECT
ARM_GP_GROUPINGS.GrpCode,
arm_cc_group_names.cc_name,
CST_COSTCENTRE.CC_CODE,
CST_COSTCENTRE.CC_NAME,
CST_COSTCENTRE.CC_LEVELPOINTER,
CST_COSTHEADER.CH_CODE,
CST_COSTHEADER.CH_NAME,
CST_COSTHEADER.CH_USER3,
CST_COSTHEADER.CH_USER4,
CST_DETAIL.CT_NETT,
CST_DETAIL.CT_SORTTYPE,
CST_DETAIL.CT_PERIODNUMBR,
CST_DETAIL.CT_YEAR,
SL_ACCOUNTS.CUCODE,
SL_ACCOUNTS.CUNAME,
CST_COSTHEADER.CH_CODE
FROM
MWLIVE.dbo.CST_DETAIL CST_DETAIL
AS Detail
INNER
JOIN MWLIVE.dbo.CST_COSTCENTRE CST_COSTCENTRE
AS Costcentre
ON Costcentre.CC_CODE = Detail.CT_COSTCENTRE
INNER
JOIN MWLIVE.dbo.CST_COSTHEADER CST_COSTHEADER
AS Costheader
ON Costheader.CH_CODE = Costcentre.CC_COPYHEADER
LEFT OUTER
JOIN Costcentre
ON Costcentre.CC_LEVELPOINTER = MWLIVE.dbo.arm_cc_group_namesarm_cc_group_names.cc_levelpointer
LEFT OUTER
JOIN Costheader
ON Costheader.CH_ACCOUNT = MWLIVE.dbo.SL_ACCOUNTS SL_ACCOUNTS.CUCODE
INNER
JOIN Costheader
ON Costheader.CH_CODE = MWLIVE.dbo.ARM_GP_GROUPINGS ARM_GP_GROUPINGS.ch_code
WHERE ((CST_DETAIL.CT_YEAR='C') AND (CST_DETAIL.CT_PERIODNUMBR=1))