MySQL Syntax Error – Individual queries run successfully, but together they fail

QuestionsMySQL Syntax Error – Individual queries run successfully, but together they fail
sethbeckerman5 Staff asked 4 years ago

When trying to run the following query I get an "invalid syntax" error.

Full error message

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'select case
when id % 2 = 0 then id-1
when id = @maxid then id' at line 7

The odd part is if I run the statement by itself (without the statement) or the statement by itself (without the statement), they both execute successfully.


View on Stack Overflow