[Dbix-class] outer join with explicit criteria rears its ugly head (again)

Jason Gottshall jgottshall at capwiz.com
Tue Oct 14 17:51:31 BST 2008


Jason Gottshall wrote:
> SELECT book.*, book_user.*
> FROM book
> LEFT OUTER JOIN book_user
>   ON (    book_user.book_id = book.book_id
>       AND book.user_id      = 'givenuser'
>   )

michael reddick wrote:
> The and "book.user_id = 'giveruser'" doesn't have to be in the ON 
> statement does it? You could just put it into the where clause and it 
> should work the same.

Yeah, that's the first thing I tried, but it didn't work (on Oracle, 
anyway.) When I move the explicit criteria to the WHERE clause, I seem 
to lose the left-outer-ness of the join, and I only get back books for 
which the book_user table has a record. I'm stumped. Anyone else?

Jason




More information about the DBIx-Class mailing list