On Jun 10, 2009, at 1:39 PM, Stephen Clouse wrote:
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 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.
Hooray!!! Thank you! I didn't think of using an alias!
Jonathan
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc