34,837
社区成员




select a.*,b.url from product a left join (select proID,min(url) as url from picture group by proId) b on a.id=b.ProID
select a.*,b.url from product a,picture b
where a.id=b.proid and not exists(select 1 from picture where proid=b.proid and id>b.id)
--选择每个产品id最小的图片
select * from picture a
where not exists(select 1 from picture where proid = a.proid and id < a.id)