[Dbix-class] How would I...

Jess Robinson castaway at desert-island.me.uk
Wed Jul 4 13:09:17 GMT 2007


On Tue, 3 Jul 2007, Len Jaffe wrote:

> On 7/3/07, Kevin Esteb <kesteb at wsipc.org> wrote:
>>
>>  How would I format the following query?
>>
>>  select to_char(datetime,'YYYY-MM-DD') as date,url,sum(number_requests)
>>  from request group by date,url order by date,url;
>>
>>  I have tried several different iterations, but the "as date" seems to
>>  trip me up.
>
>
> No doubt.  I'd surmise that you'd need to do some quoting to use the word
> "date",
> which is almost certainly a reserved word in every RDBMS I've ever seen.
>
> So I'd look for a better column name.
>
> Also, it's likely that the act of grouping your results for summing is going
> to have
> the side effect of sorting them.
>

See DBIx::Class::Manual::FAQ for info on getting AS foo into your query.

Jess




More information about the Dbix-class mailing list