select m.*, p.specification, p.sales_price, p.promotion_price
from product_detail p
left join PRODUCT_IMAGE m on m.head_id = p.id and image_type = 1
and m.image_type = 1
and m.platform = 1
and m.type = 2
and m.orderby = 1
where p.serial_id = ‘42F4BE87AA0D43D98AAB99AE7B2A0DA0‘
这种写法能正确的以product_detail的serial_id为条件得到记录数2
select m.*, p.specification, p.sales_price, p.promotion_price
from product_detail p
left join PRODUCT_IMAGE m on m.head_id = p.id
where p.serial_id = ‘42F4BE87AA0D43D98AAB99AE7B2A0DA0‘
and m.image_type = 1
and m.platform = 1
and m.type = 2
and m.orderby = 1
相当于inner join
时间: 2024-10-05 10:41:35