On Wed, Jun 10, 2009 at 12:15 PM, Jonathan Otsuka <[email protected]> wrote:

>  $c->stash->{stuff} = [
>         $c->model('DB::Blah')->search(
>             {},
>             { select => ['data', { count => 'data' }], group_by => ['data
> '] }
>         )
>     ];
>

You want the "as"
attribute<http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08104/lib/DBIx/Class/ResultSet.pm#as>on
your query:

$c->model('DB::Blah')->search(
    {},
    { select   => [ 'data', { count => 'data' } ],
      as       => [ 'data', 'cnt' ],
      group_by => [ 'data' ],
    },
);

And then:

$rec->data;
$rec->get_column('cnt');

Note the necessity of using get_column here, since "cnt" is not an actual
table column and thus won't have an auto-generated accessor method.

-- 
Stephen Clouse <[email protected]>
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc

Reply via email to