Jump to content

JOIN Issues


Go to solution Solved by Barand,

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

  • Solution

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'
  • Like 1
Link to comment
https://forums.phpfreaks.com/topic/297626-join-issues/#findComment-1517993
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.