Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: DBIx::Class Query Help

by duelafn (Priest)
on Apr 26, 2011 at 15:20 UTC ( #901376=note: print w/ replies, xml ) Need Help??


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


Comment on Re^2: DBIx::Class Query Help
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://901376]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2015-07-08 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls