遇到的SQL语法错误

时间:2017-11-29 10:48:43

标签: c# mysql sql-server

我遇到SQL查询问题,我总是收到此警告,(" 不支持复合语句SQL结构或语句。")我认为由于相同的警告和查询不适用于该项目..这是我的查询代码..

IF(ISNULL((SELECT MAX(VLW_ID)+1 AS Epr1 FROM TABLE1), 0)) > (ISNULL((SELECT MAX(VLW_ID) + 1 
AS Expr1 FROM TABLE2), 0)) BEGIN SELECT ISNULL((SELECT MAX(VLW_ID)+1 AS Expr1 FROM TABLE1)
,0) END ELSE BEGIN SELECT IS NULL((SELECT MAX(VLW_ID) + 1 AS Expr1 FROM TABLE2),0) END

附加的静止图像代码,可见性易于抢夺..

Query Builder 谢谢你的帮助......

1 个答案:

答案 0 :(得分:2)

IF(ISNULL((SELECT MAX(VLW_ID)+1 AS Epr1 FROM TABLE1), 0)) > (ISNULL((SELECT
MAX(VLW_ID) + 1 AS Expr1 FROM TABLE2), 0)) BEGIN SELECT ISNULL(               
(SELECT MAX(VLW_ID)+1 AS Expr1 FROM TABLE1) ,0) END ELSE BEGIN SELECT ISNULL(                
(SELECT MAX(VLW_ID) + 1 AS Expr1 FROM TABLE2),0) END

你在最后一个SELECT中使用了ISNULL中的额外空格,只需删除它,它应该可以工作。