[Dbix-class] How would I...

Len Jaffe lenjaffe at jaffesystems.com
Wed Jul 4 01:34:04 GMT 2007


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.

Len.
-- =

lenjaffe at jaffesystems.com
614-404-4214
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070703/aa3=
a2d8c/attachment.htm


More information about the Dbix-class mailing list