select 完好=(case when wh is Null then 0 else wh end) from jx_scyyqkb where month(insert_time)=1select case when month(insert_time)=1 then isnull(wh,0) end from jx_scyyqkb select 完好=isnull(wh,0) from jx_scyyqkb where month(insert_time)=1
不能用=null的 判断null 要用 is null 如果要对null值替换就用 isnull函数
如果要对null值替换就用 isnull函数
如果判断null 应该is null 如果要对null值替换就用 isnull函数
if exists(select * from table1)
select * from table1
else
select * from TABLE2真的很笨.我说的是方法噢!