[Dbix-class] JOIN question
Bernhard Graf
dbic2 at augensalat.de
Mon Nov 27 08:05:05 GMT 2006
Matt S Trout wrote:
> > SELECT me.title
> > FROM email me
> > LEFT JOIN chunk chunks ON chunks.email=me.id
> > LEFT JOIN chunk chunks_2 ON chunks_2.email=me.id AND chunks.id!=chunks_2.id
>
> why not just join => [ qw/chunks chunks/ ] and add { 'chunks.id' =>
> \"!= chunks_2.id" } to the where?
Thanks for the answer, but this must be in the JOIN ... (ON ...) part to
work correctly.
I tried to put it into the from-attribute
$attribute->{from} = [
{me => 'email', -join_type => 'left'},
[
{chunks_2 => 'chunk'},
{'chunks_2.email' => 'me.id', 'chunks.id' => \'!=chunks_2.id'}
]
];
and failed with a similar error as before:
FROM email me JOIN chunck chunks_2 ON ( chunks.id = SCALAR(0x2e06800)...
moreover the -join_type setting is ignored.
--
Bernhard Graf
More information about the Dbix-class
mailing list