[Dbix-class] Joins with circular relations
Bernhard Weisshuhn
bkw at weisshuhn.de
Thu Oct 4 09:16:41 GMT 2007
On Wed, Oct 03, 2007 at 11:51:05PM +0100, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Wed, Oct 03, 2007 at 06:17:54PM +0200, Bernhard Weisshuhn wrote:
> >
> > [...]
> >
> > SELECT
> > translatedwords.translatedword
> > FROM
> > userwords
> > JOIN users ON (users.user = userwords.user)
> > JOIN translatedwords ON (
> > translatedwords.language = users.language AND
> > translatedwords.englishword = userwords.englishword
> > )
> > WHERE
> > userwords.user='someuser';
>
> Just move on or other of the two cond in the second join into the
> WHERE clause.
OIC, thanks! So it's more of an SQL::Abstract issue then.
So I came up with this one:
my $userwords = $schema->resultset('Translatedwords')->search(
{
'user.user' => 'someuser',
'me.language' => \'= user.language'
},
{
join => { englishword => { userwords => 'user' } }
}
);
Is there a way to avoid the ugly scalar reference?
Thanks in advance,
bkw
More information about the DBIx-Class
mailing list