lots of code take some code, share some code!

SQL Case Statement



You can use a case statement in SQL like so:

SELECT
id, `name`, title,
CASE id
WHEN 2 THEN 1
WHEN 3 THEN 1
ELSE 0
END AS selectedCase
FROM table

One Response to “SQL Case Statement”

  1. ????? says:

    Very NIce

Leave a Reply

 
 
Please enter the word above into the box below, the word is not case sensitive.
 
If you have trouble reading the word above then click here to load a new word.
Security word: