Very quick question!
If a table FK has a null value is there any way that I can design my query so that it does not bother joining the table the foreign key is associated to. I am currently using Left Joins.
Is there another join I could use or can I do something like this in my query using PHP?
if (table foreign key == NULL)
{
do not join table that foreign key points to
}
else
{
join table using foreign key value
}
Thanks
Can you post your table and key names? we can then write the query – I think it needs to be an inner join to avoid the nulls.
For your schema
Why not deal with your NULL with a CASE statement and push an empty string instead?
(note: I’m not the best at CASE – 😉 hopefully that gets you close enough)