[Dbix-class] join ON *AND*
Moritz Lenz
moritz at faui2k3.org
Fri Feb 21 09:40:58 GMT 2014
On 02/21/2014 10:28 AM, Carl Franks wrote:
> On 21 February 2014 09:22, Hartmaier Alexander
> <alexander.hartmaier at t-systems.at> wrote:
>> Just restrict the resultset:
>> ->search({
>> 'response_comments.alert' => 1,
>> 'response_comments.status => 'posted',
>> }, {
>> ...
>> });
>>
>
> Hi,
> Thanks for the response.
> Unfortunately, that adds the clause after a "WHERE", which causes it
> to only return queries which have a related response_comment - e.g.
> id | title | count(response_comment.id)
> ---------------------------------------
> 2 | two | 1
> - it doesn't return any rows where count=0.
>
> I'm looking at the docs now for add_relationship() - I'm wondering
> whether I need to create a new relationship which contains the AND
> clauses.
When I recently asked the same question on IRC, that was the answer I
got: you need to add new relationship and specify that in the join.
Cheers,
Moritz
More information about the DBIx-Class
mailing list