CASE WHEN uid <>32 THEN uid ELSE NULL END buid
FROM `contacts` WHERE ( contacts.uid = 32 ) OR ( contacts.fuid = 32 )
IF(expr1,expr2,expr3)如果 expr1 是TRUE (expr1 <>0 and expr1 <>NULL),则 IF()的返回值为expr2否则返回值则为 expr3。IF() 的返回值为数字值或字符串值,具体情况视其所在语境而定。
示例:select *,if(sva=1,"男","女") as ssva from taname where sva != ""或者用case语法:
select CASE sva WHEN 1 THEN '男' ELSE '女' END as ssva from taname where sva != ''
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)