[Dbix-class] Issues with using the as=>[...] parameter
Brandon Black
blblack at gmail.com
Thu Nov 2 23:48:01 GMT 2006
On 11/2/06, John Napiorkowski <jjn1056 at yahoo.com> wrote:
> Hi,
>
> Not sure if I am doing this correctly. I am trying to
> order a result by the count of something but the 'as'
> parameter doesn't seem to do what I think it should
> do:
[...]
> Can anyone spot what I am doing wrong here?
From: http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#as :
Please note: This will NOT insert an AS employee_count into the SQL
statement produced, it is used for internal access only. Thus
attempting to use the accessor in an order_by clause or similar will
fail miserably.
To get around this limitation, you can supply literal SQL to your
select attibute that contains the AS alias text, eg:
select => [\'myfield AS alias']
-- Brandon
More information about the Dbix-class
mailing list