例如:查询语句select case 字段 when 1 then '一'
when 2 then '二' end from 表名
控制流程函数CASE value WHEN [compare-value] THEN result [WHEN
[compare-value] THEN result ...] [ELSE result] END CASE WHEN [condition]
THEN result [WHEN [condition] THEN result ...] [ELSE result] END
例:
mysql>SELECT IF(1<2,'yes ','no')
->'yes'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)