[Dbix-class] Join Three Tables With Aggregate Functions

2012-10-05 Thread scott
Dear All, I have bit of SQL (mysql) which joins three tables to get all the records form the first table and sums from the 2 remaining tables. The SQL looks like: select t1.*, t2_total, t3_total from t1 left join (select t1.id as t1_id, sum(t2.total) as t2_total from t1 left join t2

Re: [Dbix-class] Join Three Tables With Aggregate Functions

2012-10-05 Thread Hailin Hu
enable DBIC_TRACE=1 and run it, you can check the sql generated and see what actually happened. 2012/10/05 19:06 sc...@simpzoid.com: Dear All, I have bit of SQL (mysql) which joins three tables to get all the records form the first table and sums from the 2 remaining tables. The SQL looks

Re: [Dbix-class] Join Three Tables With Aggregate Functions

2012-10-05 Thread Trevor Leffler
Hi Scott, The cookbook has a section that should help you form subqueries in your search: http://search.cpan.org/dist/DBIx-Class-0.08121/lib/DBIx/Class/Manual/Cookbook.pod#Correlated_subqueries Note how a subquery can return a column max (or sum in your case) while referencing the outer

[Dbix-class] Can't install 08201

2012-10-05 Thread Alan Humphrey
Hi all - I'm trying to install the latest version of DBIx::Class via cpanm. I'm running perl 5.14 under Ubuntu 12.04. The installation fails with: -- Working on DBIx::Class Fetching http://search.cpan.org/CPAN/authors/id/F/FR/FREW/DBIx-Class-0.08201.tar.gz ... OK Configuring