可以使用IFNULL方法。 例子: SELECT IFNULL(val,0) FROM `test`; 意思为查询test表其中val字段如果值是null,则返回0; 转载于:https://www.cnblogs.com/ljl-blog/p/5250768.html