No subject


Tue Oct 10 10:21:22 CEST 2006


.. sort my results based on fields I've aliased using as?

    You don't. You'll need to supply the same functions/expressions to
order_by, as you did to select.

    To get "fieldname AS alias" in your SQL, you'll need to supply a
literal chunk of SQL in your select attribute, such as:

     ->search({}, { select => [ \'now() AS currenttime'] })

    Then you can use the alias in your order_by attribute.

I am able to get to $l->list_count.  The problem is I can't get the
SQL to say "AS list_count" which is needed for my order by and group
by statements.

The hack above in the FAQ tells how to do this, but like I said
before, I can't get the syntax defined in the FAQ to work with the
"select => [ { count => 'list_id' } ]".

According to the docs, this should work (by work I mean produce
"select count (list_id) as list_count):

select => [ { count => 'list_id' }, \' AS list_count']

Of course it fails on syntax, so I'm at a loss.

Any help is appreciated!

Kevin
-- 
Kevin Old
kevinold at gmail.com



More information about the Dbix-class mailing list