select count(decode(mc,null,null,1)) ymcs, count(decode(mc,null,1,null)) wmcs, from totalgroup group by bh
这句话的意思 将totalgroup表 根据小组编号bh分组
然后把小组中有名称的人(mc 不为null)人数统计和小组中没有名称的人(mc 为null)人数统计
注意这里decode(mc,null,null,1) 当值为1时才会去count null是不计入数量
select count(decode(mc,null,null,1)) ymcs, count(decode(mc,null,1,null)) wmcs, from totalgroup group by bh
这句话的意思 将totalgroup表 根据小组编号bh分组
然后把小组中有名称的人(mc 不为null)人数统计和小组中没有名称的人(mc 为null)人数统计
注意这里decode(mc,null,null,1) 当值为1时才会去count null是不计入数量