I have a relationship between two tables, authors and styles. Every author is associated with a style, with the special case where an author doesn’t have a style (IS NULL).
There’s no problem in setting the reference to NULL, but there’s a problem doing a query to select the authors and styles.
For example, the query:
SELECT 'authors'.'id', 'authors'.'name', 'styles'.'name', 'authors'.'comments' FROM 'authors' , 'styles' WHERE 'authors'.'style' = 'styles'.'id'
just ignores the authors that have a NULL style (as expected).
I need to do a select that also lists authors with NULL style, like a left join would do (I can’t use LEFT JOIN fo some reasons).
There’s a solution that doesn’t include explicit joins?
The most obvious solution is a LEFT OUTER JOIN.
See: http://www.postgresql.org/docs/8.1/static/tutorial-join.html
If you don’t want to use explicit joins you should be able to use a UNION