打开 navicat,新建查询

    1. SELECT
    2. f.id AS rootCatId,
    3. f.`name` AS rootCatName,
    4. f.slogan AS slogan,
    5. f.cat_image AS catImage,
    6. f.bg_color AS bgColor,
    7. i.id AS itemId,
    8. i.item_name AS itemName,
    9. ii.url AS itemUrl,
    10. i.created_time AS createdTime
    11. FROM
    12. category f
    13. LEFT JOIN items i ON f.id = i.root_cat_id
    14. LEFT JOIN items_img ii ON i.id = ii.item_id
    15. WHERE
    16. f.type = 1
    17. AND i.root_cat_id = 7
    18. AND ii.is_main = 1
    19. ORDER BY
    20. i.created_time DESC
    21. LIMIT 0,6

    image.png