我在SQL Server中进行查询并收到错误
' order'
附近的语法不正确
我已经看过几个关于它的问题,并对代码进行了修改,但我看不出我的错误。
这是查询:
SELECT
datepart(month, nota.DT_Sale_Forma_Bill_Exit) AS mon_text,
sum(SUM(nota.NM_Material)) OVER (ORDER BY datepart(month,nota.DT_Sale_Forma_Bill_Exit))
FROM
DW_DTS_Representative usuario
INNER JOIN
DIS_DTS_Invoice_Fact nota ON usuario.SK_Representative = nota.SK_Representative
INNER JOIN
DW_DTS_Operation_Nature cfop ON cfop.SK_Operation_Nature = nota.SK_Operation_Nature
INNER JOIN
DW_DTS_Emitter cli ON cli.SK_Emitter = nota.SK_Emitter
WHERE
nota.CD_Currency = '1'
AND nota.CD_Site = '001'
AND nota.DT_Sale_Forma_Bill_Exit = '2017'
AND cli.CD_Customer_Group != '16'
GROUP BY
datepart(month, nota.DT_Sale_Forma_Bill_Exit)
ORDER BY
datepart(month, nota.DT_Sale_Forma_Bill_Exit)