打开 navicat,新建查询
SELECT
f.id AS rootCatId,
f.`name` AS rootCatName,
f.slogan AS slogan,
f.cat_image AS catImage,
f.bg_color AS bgColor,
i.id AS itemId,
i.item_name AS itemName,
ii.url AS itemUrl,
i.created_time AS createdTime
FROM
category f
LEFT JOIN items i ON f.id = i.root_cat_id
LEFT JOIN items_img ii ON i.id = ii.item_id
WHERE
f.type = 1
AND i.root_cat_id = 7
AND ii.is_main = 1
ORDER BY
i.created_time DESC
LIMIT 0,6