[Dbix-class] joining subqueries

Diab Jerius djerius at cfa.harvard.edu
Wed Feb 7 18:45:50 GMT 2018


On Fri, Feb 2, 2018 at 5:24 PM, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
> On 01/26/2018 10:12 PM, Diab Jerius wrote:
>>
>> Howdy!
>>
>
> Hi!
>
> I somehow marked your email is read without having read it D:
>
>>
>> But now I'm stuck.  How do I perform a join with the second subquery?
>
>
> Currently you can not do this with DBIC-level APIs alone. There is no quick
> fix for this. But that's ok because at any point you can feed arbitrary SQL
> to the chaining structure.
>
> You will have to do some surgery to assemble the query you want, by
> extracting it from $rs1->as_query / $rs2->as_query, and mangling the first
> value of the returned structure.
>
> Then once you have the \[ $sql, @binds ] that you want to see you'd simply
> feed them to:
>
> ->search( {}, { from => \[...], <rest of attrs> } );
>
> Hope this helps!
>

Thanks.

I'll give that a whirl and see what happens.

Diab



More information about the DBIx-Class mailing list