[Dbix-class] Using { count => 'me.list_id' } with AS hack from the FAQ
Kevin Old
kevinold at gmail.com
Tue Oct 10 17:02:15 CEST 2006
On 10/10/06, Ash Berlin <ash at cpan.org> wrote:
> Kevin Old wrote:
> > Hello everyone,
> >
> > I'm trying to use the hack defined in the FAQ for "sort my results
> > based on fields I've aliased using as" with the following statement
> > which includes a count.
> >
> > $schema->resultset("MyTable")->search(undef, { select => [ { count =>
> > 'list_id'} ], as => [ 'list_count' ] });
> >
> > Can someone give me the syntax for this statement for the hack? I've
> > tried just about every combination of inserting \' as list_count' but
> > nothing seems to work.
> >
> > Any help is greatly appreciated,
> > Kevin
> >
> Define doesn't work.
>
> If you mean $rs->list_count says no such method, then yes - it doesn't
> create an accessor for it. to $rs->get_column('list_count')
>
> If you mean the query doesn't run, then please tell us what error it gives.
>
> Ash
Hi Ash,
This is what I'm trying to add to my resultset:
More information about the Dbix-class
mailing list