PDA

View Full Version : Inner Join using 3 tables??


tux
10-03-2009, 11:23 AM
Hi all,

I want to inner join 3 tables in the same query.

I am joining 2 with this code at present but need to add another to accomplish what I need.

$result = mysql_query("SELECT * FROM cart INNER JOIN products ON cart.productID = products.productID WHERE cart.cookieID = '" . GetCartId() . "' ORDER BY products.productID ASC");
$cart = mysql_fetch_array($result);

Can anyone show me the syntax to add a third table.

Thanks, Paul

edbr
10-04-2009, 01:58 AM
result = mysql_query("SELECT * FROM cart INNER JOIN products ON cart.productID = products.productID JOIN tble3 ON table2.productID = table2.productID WHERE cart.cookieID = '" . GetCartId() . "' ORDER BY products.productID ASC");

should do it