GROUP_CONCAT 可以将分组的字段进行拼接处理.
SELECT
g.id, g.merchant_id, g. NAME, g.introduction, g.cover_pic, g.play_pic, g.amount, g.price, g.audit_status, g.audit_apply_time, g.audit_update_time, c.payment_ratio, c.period, m.id id1, m.merchant_nameFROM tb_goods_info gLEFT JOIN ( SELECT goods_id, payment_ratio, GROUP_CONCAT(period SEPARATOR '期,') AS period FROM tb_goods_config GROUP BY goods_id) c ON g.id = c.goods_idLEFT JOIN tb_merchant m ON g.merchant_id = m.id