mysql數據庫字段判斷語句
一、CASE field WHEN value THEN value WHEN ... THEN ... ELSE ...
sample: www.2cto.com
Sql代碼
select CASE usertype WHEN 1 '管理員' WHEN 2 THEN '策劃' WHEN 3 THEN '測試員' ELSE '未定義' AS usertype FROM users
二、IF( exp, value, value)
Sql代碼
IF (1 = 1,'A','B')