null值要用IS NULL判断,不能用“=”。select case when a is null then '0' else a end as a from 表名。0如果是数值型,可以直接写0,不加引号。null 跟''不一样,如果有''值,需要在条件写case when a is null or a=''。