Subject Re: [ib-support] Group By Month, Day, Year etc...
Author Claudio Valderrama C.
""lfeliz"" <lfeliz@...> wrote in message
> I amusing Firebird 1. I need to create a query that generates
> summary totals by month. I had been using EXTRACT w/Month and
> getting all detail and calc'ing summary using my app, but I want the
> server to do the work. Is there a UDF that does data stuff so I can
> take advantage of the GRP-By UDF in FB 1.0.

Create a view that does the extract calls then group by that view. All boils
down to FB not accepting
group by number (non-standard SQL extension)
but not accepting either
group by field_alias.

The view overcomes those problems. It provides named fields (aliases) for
your expressions. Extract() creates an expression-based field.

Otherwise, use triggers to pre-calculate your month, it will be faster when
you do the select and you can index that field if you find that it's faster
with an index to group records.

Claudio Valderrama C. - -
Independent developer
Owner of the Interbase® WebRing