$sql ="select c.goods_name from c left join b on b.goods_id=c.goods_id left join a on a.goods_id=c.goods_id where a.isbest=0 and b.cat_id="B"";