Jump to content

JOIN Issues


rseigel

Recommended Posts

SELECT * FROM ps_product_supplier JOIN ps_product JOIN ps_product_attribute USING (id_product) WHERE ps_product.active = '1' AND ps_product.ean13 = '' AND ps_product_attribute.ean13 = '' AND ps_product.id_category_default != '73'

This doesn't work (no surprise from those with way more experience here than me).

 

The common column between the 3 tables is id_product.

 

I know everything past the WHERE works. Things went sideways when I introduced the 2nd join (ps_product_attribute).

 

Please help.....  :wtf:

Link to comment
https://forums.phpfreaks.com/topic/297626-join-issues/
Share on other sites

You need to specify the join condition for each join

SELECT * 
FROM ps_product_supplier 
    JOIN 
    ps_product USING (id_product)
    JOIN 
    ps_product_attribute USING (id_product) 
WHERE ps_product.active = '1' 
    AND ps_product.ean13 = '' 
    AND ps_product_attribute.ean13 = '' 
    AND ps_product.id_category_default != '73'
Link to comment
https://forums.phpfreaks.com/topic/297626-join-issues/#findComment-1517993
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.