SELECT
u.*, GROUP_CONCAT(f.name) fname
FROM
tb_user u
LEFT JOIN tb_middle ph ON u.id = ph.pid
LEFT JOIN tb_favorite f ON ph.fid = f.id
GROUP BY
u.id
用户表与爱好表查询语句
最新推荐文章于 2021-10-04 18:52:17 发布
SELECT
u.*, GROUP_CONCAT(f.name) fname
FROM
tb_user u
LEFT JOIN tb_middle ph ON u.id = ph.pid
LEFT JOIN tb_favorite f ON ph.fid = f.id
GROUP BY
u.id