[eluser]jwindhorst[/eluser]
Hoping someone out there can help me out with this SQL issue. I have two 3 tables in my db
tree_struct,
tree_nodes,
product_assets
tree_nodes has as asset_id field that refers to the id field of the products assets field. Tree nodes can be either type='folder' or type='file'. When tree_nodes.type='file' then tree_nodes.asset_id will be populated, otherwise it is null.
Now, I want to be able to join my product_assets, but when tree_nodes.asset_id is null, it just skips the row.
Code:
SELECT * FROM
tree_struct, tree_nodes, product_assets
WHERE
tree_struct.node_id = tree_nodes.id
AND
tree_nodes.asset_id = product_assets.id
The last part of the where clause is necessary when there is an asset_id set, but causes the whole row to fail if it is not.
Please help, banging my head, and not to the music!