牛骨文教育服务平台(让学习变的简单)
博文笔记

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

创建时间:2016-10-22 投稿人: 浏览次数:28376
1、不为空


Select   *   From   table Where id<>""


Select   *   From   table Where id!=""


2、为空


Select   *   From   table Where id=""


Select   *   From   table Where   ISNULL(id)




具体情况具体分析,如果字段是char和varchar型用 id=""可以;如果是int型用 ISNULL好些
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。