统计不同商品名称上的商品数量 方式一 符合商品的为true,不符合的为空 select count(goods_name = "测试" or null) as count1, count(goods_name = "菲律宾进口香蕉" or NULL) AS couunt2 from tb_goods_spu; 方式二 如果符合商品的为1,不符合的为0 select sum(IF(goods_name = "测试",1,0)) as count1, sum(IF(goods_name = "菲律宾进口香蕉",1,0)) as couunt2 from tb_goods_spu;