[Dbix-class] Problem with getting a grouped count

Matija Grabnar matija.grabnar at arnes.si
Sun Mar 19 22:29:56 CET 2006


I've been trying to follow the example made in the cookbook, but for some reason, the "as"=> part doesn't seem
to be working:

my $qs=$schema->resultset('Schema::Msgs')->search({},
     {select   => [ 'quar_type',{ count => '*' } ],
      join     => [ qw/quarantined/],
      as       => [ qw/quar_type qcount/],
      group_by => [ qw/quar_type/],
     });

Here is the actualy query that gets executed:

SELECT quar_type, COUNT( * ) FROM msgs me LEFT JOIN quarantine quarantined ON ( quarantined.mail_id = me.mail_id ) GROUP BY quar_type

The problem is that since the as part doesn't execute, I can't do an order_by /qcount/, and what's even
worse, I can't get to the count!

What should I change?




More information about the Dbix-class mailing list