SELECT a.*,COUNT(b.attr_name) AS num FROM cz_goods_type AS a
LEFT JOIN cz_attribute AS b
ON a.type_id = b.type_id GROUP BY a.type_id ORDER BY type_id
sql联合查并统计子表符合的总数
最新推荐文章于 2024-07-24 22:55:47 发布
SELECT a.*,COUNT(b.attr_name) AS num FROM cz_goods_type AS a
LEFT JOIN cz_attribute AS b
ON a.type_id = b.type_id GROUP BY a.type_id ORDER BY type_id