SELECT distinct c.`name` as cat_name, g.* FROM `yec_goods` g ,`yec_category` c , `yec_goods_spec` sp where g.cat_id = c.id and g.goods_id = sp.goods_id and (g.cat_id in(145) or g.goods_id IN ('') ) and g.brand_id=84 and g.status=1 and uptime<=1715310695 order by salenum desc limit 0,20