rseigel Posted August 4, 2015 Share Posted August 4, 2015 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..... Quote Link to comment https://forums.phpfreaks.com/topic/297626-join-issues/ Share on other sites More sharing options...
Solution Barand Posted August 4, 2015 Solution Share Posted August 4, 2015 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' 1 Quote Link to comment https://forums.phpfreaks.com/topic/297626-join-issues/#findComment-1517993 Share on other sites More sharing options...
rseigel Posted August 4, 2015 Author Share Posted August 4, 2015 Thanks very much. That works. I have other issues with the code (trying to grab the right fields among all the tables) but what you did makes perfect sense. Quote Link to comment https://forums.phpfreaks.com/topic/297626-join-issues/#findComment-1517994 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.