Skip to content

Instantly share code, notes, and snippets.

@huangzhuolin
Created September 14, 2018 02:53
Show Gist options
  • Save huangzhuolin/3e52ea807986b0b1508ea6930819ba5e to your computer and use it in GitHub Desktop.
Save huangzhuolin/3e52ea807986b0b1508ea6930819ba5e to your computer and use it in GitHub Desktop.
[mysql select case when] #mysql
select case field_a
when '1' then 'cat'
when '2' then 'dog'
else 'unknown'
end
from my_table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment