Of course, there's information on the internet about the format for writing a CASE query in MySQL, but no matter how much I looked, the information turned out to be wrong.
Here's the correct format:
CASE tablefield WHEN opt1 THEN result1 WHEN opt2 THEN result2 ELSE result3 END
For example, most sites write "END CASE" at the end instead of a simple "END", which, of course, is wrong (I won't give examples of the sites - I don't want to point fingers - these are very respected sites, and I'm sure this mistake, while unfortunate, is a case of "accidentally copying an error from one another"). Applies to: MySQL 5.x
Comments