取出parentid为null的顶级栏目 等号改为 is null 避免null当做字符串,

mysql中查询字段为null或者不为null
在mysql中,查询某字段为空时,不可用等号 = null,
而是 is null,不为空则是 is not null 
 
select * from category where  parentid is null;  //取出顶级栏目,作为标题
 
select * from category  where  parentid is not null;
posted @ 2016-04-06 17:13  小庄啊  阅读(283)  评论(0编辑  收藏  举报