使用此SQL:
SELECT p.*
FROM shop_products p, shop_product_attributes c
WHERE c.type = 'category' AND p.sequence = c.value AND c.value = '1'
它两次显示相同的记录。
应该示出从排shop_products where shop_products.sequence
是在shop_product_attributes.product_seq
和shop_product_attributes.value
是'1'
SELECT s.*
FROM shop_products s
where s.sequence
in(select distinct product_seq from shop_product_attributes where type = 'category' and value=1)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句