nyvokub
nyvokub

Reputation: 569

Why isn't this CASE operator working?

    SELECT id, 
           created,
           CASE
             WHEN signed = 0 THEN 'no'
             ELSE 'yes'
    FROM resumes

Not sure why this is throwing the following SQL error:

#1064 - 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 'CASE

Upvotes: 0

Views: 19

Answers (1)

Blue
Blue

Reputation: 22911

You're missing END at the end of your case statement:

SELECT id, 
       created,
       CASE
         WHEN signed = 0 THEN 'no'
         ELSE 'yes'
       END
FROM resumes

Upvotes: 2

Related Questions