您的位置:首页 > 编程语言 > PHP开发

php mysql查找字段空、不为空的方法总结

2018-01-19 18:12 295 查看
1、不为空

Select   *   From   table Where id<>''

Select   *   From   table Where id!=''

2、为空

Select   *   From   table Where id=''

Select   *   From   table Where   IS NULL(id)

具体情况具体分析,如果字段是char和varchar型用 id=''可以;如果是int型用 IS NULL好些
在mysql中,查询某字段为空时,切记不可用 = null,
而是 is null,不为空则是 is not null
www.2cto.com
select * from table where column is null;

select * from table where column is not null;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: