MYSQL Left Join Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mischievous
Forum Commoner
Posts: 71
Joined: Sun Apr 19, 2009 8:59 pm

MYSQL Left Join Question

Post 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
Post Reply