条件查询的结果id的值为null,但是我们通常不希望用null,我们就会希望用一个数字去替换它
select user_id from sm_user where user_password = "111" and user_phone = "111";
替换的方法是利用IFNULL
select IFNULL((select user_id from sm_user where user_password = "111" and user_phone = "111") ,0) ;
Mysql中条件查询id结果为null,替换成0或者其他数字
阅读 118
2022-08-02
条件查询的结果id的值为null,但是我们通常不希望用null,我们就会希望用一个数字去替换它
select user_id from sm_user where user_password = "111" and user_phone = "111";
替换的方法是利用IFNULL
select IFNULL((select user_id from sm_user where user_password = "111" and user_phone = "111") ,0) ;
相关推荐
精彩评论(0)