[Dbix-class] JOIN question
Bernhard Graf
dbic2 at augensalat.de
Thu Nov 30 08:54:24 GMT 2006
Stephan Szabo wrote:
> If we have an email row with id 1 and a chunk row with id 10 and
> email 1 and no other rows in either table, my understanding is that
>
> > >>>>> FROM email me
> > >>>>> LEFT JOIN chunk chunks ON chunks.email=me.id
> > >>>>> LEFT JOIN chunk chunks_2 ON chunks_2.email=me.id
>
> gives you a result like
> (me.id=1, chunks.email=1, chunks.id = 10, chunks_2.email=1,
> chunks_2.id=10)
> and then a WHERE clause like your proposed would filter the row out,
> while the intended behavior is that you'd get a row like (me.id=1,
> chunks.email=1, chunks.id = 10, chunks_2.email=null,
> chunks_2.email=null).
Exactly.
"chunks.id!=chunks_2.id" servers completely different purposes if it is
either in a LEFT JOIN or else in the WHERE part.
--
Bernhard Graf
More information about the Dbix-class
mailing list