http://www.perlmonks.org?node_id=901376


in reply to Re: DBIx::Class Query Help
in thread DBIx::Class Query Help

Ah, fabulous that does help a lot. Aside from having to remove duplicates in perl, the following does exactly what I was after:

sub accounts { my $self = shift; my $rs = $self->search({}, { select => ["project_id", "chart.accno", "chart.descript +ion", "SUM(amount)"], as => ["project_id", "accno", "description", "bal"] +, group_by => ["project_id", "chart.accno", "chart.descript +ion"], having => { 'SUM(amount)' => { '!=', 0 } }, join => [ "chart" ], }); $rs->result_class('DBIx::Class::ResultClass::HashRefInflator'); unique map "$$_{accno} - $$_{description}", $rs->all; }

Good Day,
    Dean