在 navicat 工具中新建查询

    1. SELECT
    2. f.id AS id,
    3. f.`name` AS `name`,
    4. f.type AS type,
    5. f.father_id AS fatherId,
    6. c.id AS subId,
    7. c.`name` AS subName,
    8. c.type AS subType,
    9. c.father_id AS subFatherId
    10. FROM
    11. category f
    12. LEFT JOIN category c ON f.id = c.father_id
    13. WHERE
    14. f.father_id = 1

    image.png