MySQL if 语句用法

IF表达式
IF(expr1,expr2,expr3)

如果 expr1 是TRUE (expr1 <> 0 and expr1 <> NULL),则 IF()的返回值为expr2; 否则返回值则为 expr3。IF() 的返回值为数字值或字符串值,具体情况视其所在语境而定。

eg:

SELECT is_great, IF(`is_great`,'','') as is_great FROM fook_business_product
原文地址:https://www.cnblogs.com/clubs/p/14435426.html