答案 0 :(得分:0)
获取所有产品及其相关图片
执行inner join
之类的
select p.product_title,
i.*
from products p join images i on p.product_id = i.image_product;
所有产品每个只有一个图像
执行group by
,然后执行join
select p.*
from products p join (
select img_product
from images
group by img_product
having count(distinct img_product) = 1) xxx on p.product_id = xxx.img_product;