Forum Moderators: coopster

Message Too Old, No Replies

inner join of 3 tables

mysql, php, inner join

         

sasori

6:41 am on Sep 19, 2009 (gmt 0)

10+ Year Member



hello, I'm trying to include another table's column in this query:
SELECT * FROM products INNER JOIN products_categories ON products_categories.pid=products.pid AND products_categories.cid

I'm trying it this way, but its not working:
SELECT products_shipping_price.price, products.* FROM products, products_shipping_price INNER JOIN products_categories ON products_categories.pid=products.pid AND products_categories.cid AND products_shipping_price.pid

but, I'm messing it up somehow.

Can you help?

Thanks!

Tommybs

3:34 pm on Sep 19, 2009 (gmt 0)

10+ Year Member



Try this -

SELECT psp.price, p.*, pc.* FROM products as p
INNER JOIN products_categories as pc
ON pc.pid = p.pid
INNER JOIN products_shipping_price as psp
ON pc.cid = psp.cid

If it doesn't work then post up some more of your table structure and I'll try to help more