turpentyne
10-18-2011, 04:22 AM
sorry.... I know I just posted, but I have an other question...
Is there a conditional to let a query pull results even if one of the joins pulls no result. Right now, if nothing is in table 4 for that entry, I get a blank page. But if it exists, the information will pull. I want to add the table4 info only if it exists and not lose the rest.
I have:
SELECT table1.*, table2.*, table3.*, table4.*
FROM table1
JOIN table2 ON table1.id = table2.id
JOIN table3 ON table3.id = table2.id
JOIN table4 ON table4.id = table2.id AND table4.part_id = 1
WHERE table1.id = $id
Is there a conditional to let a query pull results even if one of the joins pulls no result. Right now, if nothing is in table 4 for that entry, I get a blank page. But if it exists, the information will pull. I want to add the table4 info only if it exists and not lose the rest.
I have:
SELECT table1.*, table2.*, table3.*, table4.*
FROM table1
JOIN table2 ON table1.id = table2.id
JOIN table3 ON table3.id = table2.id
JOIN table4 ON table4.id = table2.id AND table4.part_id = 1
WHERE table1.id = $id