[Dbix-class] Select from subselect

Peter Rabbitson rabbit+dbic at rabbit.us
Fri Dec 16 11:40:18 GMT 2011


Allan Cochrane wrote:
> 
> On Thu, Dec 15, 2011 at 5:22 PM, Drew Taylor <drew at drewtaylor.com 
> <mailto:drew at drewtaylor.com>> wrote:
>  
> 
>     I think
>     https://metacpan.org/module/DBIx::Class::Manual::Cookbook#Subqueries
>     will be helpful to you.
> 
>     Drew
> 
> 
> Hi,
> 
> thanks, the link you gave me doesn't show the generated SQL so it's hard 
> to tell if it does what I want! :-) I find no examples in the 
> documentation of using a subquery in the 'from' attribute. There is an 
> example of that usage in the tests, which is what I ended up referring 
> to and I managed to get the SQL to look something like SELECT ... FROM 
> (SELECT ..) JOIN ... ON xxx but I still cannot see how to make more than 
> one join condition for xxx. The package test code assumes a relationship 
> between two tables, which is not the case here ...

This is correct, DBIC currently has no facility to express arbitrary joins
between arbitrary chunks of SQL. What are you actually trying to achieve
here? Is there a reason you are not running said query against the handle
directly with $schema->dbh_do ?

Cheers



More information about the DBIx-Class mailing list