Sql Srever错误('<'附近的语法不正确。) [英] Sql Srever Error (Incorrect syntax near '<'.)
本文介绍了Sql Srever错误('<'附近的语法不正确。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在尝试从以下查询中重新检索数据:
Hello,
I am trying to reterive data from following query:
Select Sum(Amount1)+sum(Amount2) as Balance1,sum(Amount3)+sum(Amount4) as balance2,sum(Amount5)+sum(Amount6) as balance3 From ABC
(convert(datetime,(
convert(nvarchar(4), year) + '-' +
convert(nvarchar(2), month) + '-' +
convert(nvarchar(2), '01'))) < '2013-04-01')
但是显示以下错误。请告诉我我错在哪里: -
消息102 ,等级15,状态1,行5
'<'附近的语法不正确。
But shows the following error.Please suggest me where am i wrong:-
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '<'.
推荐答案
你写了一个错误的查询。
没有where子句但你使用条件后来自。然后使用它然后检查并告诉我是否再次出现错误。
Hi,
You have written a wrong query.
There is no where clause but you use condition after from. Use that then check and tell me if there is error again.
您忘记了WHERE关键字:
You forgot the WHERE keyword:
Select Sum(Amount1)+sum(Amount2) as Balance1,sum(Amount3)+sum(Amount4) as balance2,sum(Amount5)+sum(Amount6) as balance3 From ABC
WHERE (convert(datetime,(
convert(nvarchar(4), year) + '-' +
convert(nvarchar(2), month) + '-' +
convert(nvarchar(2), '01'))) < '2013-04-01')
>
这篇关于Sql Srever错误('<'附近的语法不正确。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文