消息102,级别15,状态1,行18错误的语法附近','

时间:2017-06-07 07:41:53

标签: sql-server

似乎不喜欢SUM(c.[chargeable weight])之后的第一个逗号。你们能找出原因吗?我真的无法理解为什么会这样做。

    Select  
 (SUM(c.[Chargeable Weight]), MAX (ts.systemstamp), mm.MovementRef
                                FROM      dbo.whsConsignment wc
                                                   INNER JOIN dbo.cgtConsignment c ON c.[Consignment Reference] = wc.ConsignmentReference
                                                   INNER JOIN dbo.tsAdditionalColInfo ts on ts.[ConsignmentReference]= wc.ConsignmentReference
                                                    inner join dbo.movConLink m on m.ConsignmentReference = c.[Consignment Reference]
                                                   inner join dbo.movMovement mm on mm.MovementID = m.MovementID
                                                                                                            --AND wc.whsHeaderID = wh.WhsHeaderID
                                                                                                            AND wc.StatusCode = 'NL'
                                                                                                            AND c.[Service Type] = 'C'
                                                                                                            --AND ts.SlackNoSlack like 'No Slack - Must Load%' 
                                                                                                            --and ts.SLackNoSLack like 'No Slack - Tripped%'
                                                                                                            and ts.scheduledescription = 'No Slack - Tripped'
                                                                                                            group by mm.MovementRef) as chargeableweight
                                                                                                            --and ts.systemstamp = max (ts.systemstamp)
 Into #2chargns

1 个答案:

答案 0 :(得分:1)

您错过了括号内的match="Document"

SELECT