1、
case <单值表达式>
例如:
select (case t.hyml_dm
end) as hydmbm
from A 注意:这语句用在查询中,WHEN子句后面千万不要加逗号或者引号。否则就错了。
2、
case when <关系条件表达式> then <SQL语句或者返回值> end
例如:
select count(case when a.zt='07' then a.bs end),
3、
如果该字段为NULL值,想判断如果是NULL值,就转换成其它字段,如果不是NULL值,就显示原来字段
|
|
来自: 沐浴中的眼泪 > 《Sqlserver2005》