select count(*) as cnt from ( select c.goodsno from breed_store_multicategory a inner join breed_store_category b on a.cateno=b.cateno inner join breed_store_goods c on c.goodsno=a.goodsno where b.lft between AND and goods_view=0 group by c.goodsno ) as tbl