Return to Snippet

Revision: 60095
at October 20, 2012 08:14 by ginoplusio


Initial Code
SELECT id,title,
   (CASE date WHEN '0000-00-00' THEN '' ELSE date END) AS date
   FROM your_table
 
SELECT id,title,
   (CASE status WHEN 0 THEN 'open' WHEN 1 THEN 'close' ELSE 'standby' END) AS status 
   FROM your_table

Initial URL
http://www.barattalo.it/2012/10/19/13-mysql-tips/

Initial Description
How to remap a value to another inside a mysql query select.

Initial Title
Remap values inside a MYSQL query using CASE...WHEN syntax

Initial Tags
mysql, update

Initial Language
MySQL