mysql-select语句中where子句使用字段为null作为查询条件的几种方式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010675669/article/details/89918875

1.使用ISNULL(字段)函数。例子:select o.id,o.sku_id from orderItem o where ISNULL(sku_id);

2.使用is null 。例子:select o.id,o.sku_id  from orderItem o where sku_id is null;

3.使用IFNULL(字段,"替换值") 函数。例子:select o.id,o.sku_id from orderItem o where IFNULL(sku_id,0) = 0;

猜你喜欢

转载自blog.csdn.net/u010675669/article/details/89918875