Neven Stojanovic
Neven Stojanovic

Reputation: 15

SQL Syntax Errors Encountered

I have a problem with SQL Query, I always get this warning, ("The Compound statement SQL construct or statement is not supported.") I think that due to the same warning and query is not working on the project .. This is my query code ..

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

Attached still image code for the visibility to be easy to snatch ..

Query Builder thanks for the help ..

Upvotes: 0

Views: 125

Answers (1)

Rajesh Kumar
Rajesh Kumar

Reputation: 89

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

You have used a extra space in ISNULL in last SELECT, just remove that, It should work.

Upvotes: 2

Related Questions