有如下表数据:
获取“菜单”分类的子分类数据列表:
SELECT a.cat_id, a.cat_name, a.sort_order AS parent_order, a.cat_id, b.cat_id AS child_id, b.cat_name AS child_nameFROM article_cat AS a
JOIN article_cat AS b
ON b.parent_id = a.cat_id
WHERE a.parent_id = '' AND a.cat_type=1 ORDER BY parent_order ASC, a.cat_id ASC, child_order ASC
结果如下: