Le 22.11.2012 14:00, Grzegorz Dzięgielewski via RT a écrit :
Show quoted text> Thu Nov 22 08:00:18 2012: Request 81341 was acted upon.
> Transaction: Ticket created by jabbas
> Queue: SQL-Abstract-More
> Subject: Problems with JOIN
> Broken in: (no value)
> Severity: Normal
> Owner: Nobody
> Requestors: jabbas@jabbas.pl
> Status: new
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=81341 >
>
>
> When creating a join, there is no possibility to pass table.field = 'value'
> into ON(). Is there any possibility to not interpolate (add table alias or
> table name) to join specification?
> To override I can put this in the WHERE section but...
>
>
Hi,
Unfortunately I don't know how to solve this; the problem is that every
join gets transformed into a Perl class, and we can't create a new class
for every possible value that would be passed into the ON clause.
So indeed, the solution is to put that clause into the WHERE part, i.e.
$schema->join(qw/FirstTable path1 path2 .../)->select(-where =>
{field => $value});
Notice that you can add the WHERE clauses in several steps, maybe that
could help solving your needs :
my $stmt = $schema->join(qw/FirstTable path1 path2 .../)->select(
-where => {field => $value},
-result_as => 'statement',
);
# .... more processing
my $rows = $statement->refine(-where => {other_field =>
$other_value})->all;
Best regards, Laurent D.