第一种方法:select if(isnull(timestamp),0,1) as col from t_order
第二种方法:select (case when qq is null then 0 else 1 end)as qq, (case when ww is null then 0 else 1 end)as ww, (case when ee is null then 0 else 1 end)as ee from t_order;
使用select,当字段为NULL是返回0否则返回1
最新推荐文章于 2023-04-14 10:53:02 发布