继续使用“#39;)'附近的语法不正确

时间:2017-03-15 17:38:07

标签: sql

不会运行继续得到错误。我已经以不同的方式更改代码,但不断得到相同的错误。任何人都有任何建议

SELECT *
From (
Select      R.CREATED as Created, 

        Case WHEN R.SR_AREA = 'OB 1st' THEN 'OB Res 2nd'  When R.SR_AREA = 'OB Res 2nd' THEN 'OB Res 3rd' Else R.SR_AREA END as [SR_AREA] 

FROM        S_SRV_REQ AS R WITH (NOLOCK) 

WHERE       (R.INS_PRODUCT = 'Pending OB') AND 
        (R.CREATED BETWEEN @StartDate AND dateadd(d,1,@EndDate)) AND 
        (R.SR_AREA in('OB 1st','OB Res 2nd','OB Res 3rd')) AND 
        (R.RESOLUTION_CD = 'No Answer') 

UNION



SELECT      TOP (100) PERCENT R.SR_AREA, 
        R.RESOLUTION_CD 


FROM        S_SRV_REQ AS R WITH (NOLOCK) 

WHERE       ((R.INS_PRODUCT = 'Pending OB') AND (R.LAST_UPD BETWEEN @StartDate AND dateadd(d,1,@EndDate)) AND 
        (R.SR_AREA in('Inbound', 'OB Res 3rd')) OR (R.RESOLUTION_CD <> 'No Answer'))

2 个答案:

答案 0 :(得分:0)

您在陈述结尾处遗漏了最后)

 Select * From (
           .....
               ) <---

答案 1 :(得分:0)

打开(应该匹配关闭)检查我发现你有一个未闭合的(