查询中product和product_img是一对多的关系(数据库是MySQL)
select p.id,
       p.product_cost_price,
       p.product_trade_price,
       p.product_sale_price,
       p.collect_num,
       p2.collect_status,
       p2.ID as collect_id,
       p3.name,
       GROUP_CONCAT(p1.img_path SEPARATOR '|') as imgPath
from dn_product as p
       left join dn_product_img as p1 on p.id = p1.product_id
       left join dn_product_collect as p2 on p.id = p2.product_id
       left join dn_person as p3 on p3.ID = p2.person_id
group by p.ID
limit 10

SQL查询一对多返回一条数据

相关文章:

  • 2022-12-23
  • 2022-01-02
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案