see thats fine, but now what I want is if there are no entries in one of
the tables to still return the data it knows about. ie.
select * from product
================
1234 truck
select * from product_category
========================
1234 automobile
select * from product_image
======================
Empty Set
select * from product, product_category, product_image
============================================
1234 truck 1234 automobile NULL NULL
Can this be done ?
A LEFT JOIN preserves the left table, i.e. it returns all the rows in the left table. You have to decide which table is going to be your left table, and then you can do
FROM (left_table LEFT JOIN another_table) LEFT JOIN remaining_table
ON <list of join conditions>
This will give you all the rows from left_table with any matching rows from the other two tables, or NULLs when there's no matching rows.
Every image has to have a product, but not every product has to have an image. Every product has to have a category, but not every category has to have a product. So I would guess that you want product_category as your left table.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak