
Untitled
By: a guest on
May 21st, 2012 | syntax:
None | size: 0.62 KB | hits: 18 | expires: Never
MySQL Formating Strings or Returning Empty string on NULL
select if(tinyint_value,'yes','no')
select if(property.price is not null, CONCAT('$',FORMAT(property.price,2)),'')
select case column when 1 then 'Yes' else 'No' end as columalias ,
case when stringcolumn is NULL then '' else stringcolumn end as stringcolumn
from table
select case column when 1 then 'Yes' else 'No' end as columalias ,
IFNULL(stringcolumn,'') as stringcolumn
from table
SELECT COALESCE(NULL, 1);
-> 1
SELECT COALESCE(2, 1);
-> 2
COALESCE(field,'')
CASE WHEN fieldtiny = 1 THEN 'Yes' ELSE 'No' END AS YESNOFIELD