> Sometimes I need to make queries and join tables, knowing that theYou gave the answer yourself. By using an OUTER JOIN.> other table rows are not always available.
> I do
> SELECT question.author, ..., textbooks.picture
> WHERE textbooks.id = questions.tb_id
> the problem is that sometimes questions.tb_id is NULL (textbook was
> not supplied in question), and what I want to have for
> textbook.picture is a NULL. But I want the row returned if it exists
> in questions.
> How would I do it?
Now, joining tables in the WHERE clause has it drawbacks. Today,
there was a post in this forum asking about it -> read "JOIN vs no JOIN"
and you'll get your answer.
Database Workbench - development tool for MySQL, and more!
Database development questions? Check the forum!