一个字段一个字段的判断就是a和b都不等于0返回的话select table.*, (case when a<>0 and b<>0 then c%a else 0 end) as e, (case when a<>0 and b<>0 then (c%a)%b else 0 end) as dfrom table where ……如果是其他情况,再添加case when条件