Page 1 of 1

MYSQL Left Join Question

Posted: Thu May 28, 2009 2:22 pm
by mischievous
I am trying to run a query that will combine two tables but allow me to search for a match between the pd_id.

Products Table:
pd_id cat_id pd_name pd_cartname pd_manufacturer pd_model pd_date pd_last_update
1 1 Test Product 1 testproduct1 Mr. Tester Inc. NULL 0 2009
2 2 Test Product 2 testproduct2 Mr. Tester Inc. NULL 0 2009

Skus tables
id pd_id sku price qty short_description long_description extra_images has_options has_acc has_xsell
1 1 34362346246 35.89 1 This is a test descript This is a test descript 1 0 1

This query works but only gives me the result of the products table

Code: Select all

 
SELECT * FROM product LEFT JOIN skus ON product.pd_id=skus.pd_id WHERE product.pd_id = $result->pd_id
 

N/M Figured it out:

Code: Select all

SELECT * FROM product LEFT JOIN skus ON product.pd_cartname=$product WHERE product.pd_id = skus.pd_id