Subject | Re: Aggregation and selectable SP |
---|---|
Author | Carlos Macao |
Post date | 2005-12-12T12:00:36Z |
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
Thank you for your reply,
Nope, it still performs the aggregation over the S.SELLING_DATE
instead WEEK_NO.
Carlos Macao
<svein.erling.tysvaer@k...> wrote:
Thank you for your reply,
Nope, it still performs the aggregation over the S.SELLING_DATE
instead WEEK_NO.
Carlos Macao
>number,
> I think this should be something like
>
> select WOY.WEEK_NO WEEK, S.SELLING_DATE, sum(S.TOTAL_DAY_SELLING)
> from SELLINGS S
> left join WEEK_OF_YEAR(S.TOTAL_DAY_SELLING) WOY ON 1=1
> group by 1, 2
>
> Though I must admit I've never tried it and don't know whether it
> works or not...
>
> Set
>
> --- In firebird-support@yahoogroups.com, "Carlos Macao" wrote:
> >
> > Hi,
> >
> > I Want to obtain the selling total amount grouped by week
> > how can I do this sum on a selectable SP?speed
> >
> > With this example, the aggregation is performed on the
> > TOTAL_DAY_SELLING instead of the WEEK_NO.
> >
> > And I would prefer to this with a SP, rather than a UDF, for
> > and installation reasons.
> >
> > select
> > (select WEEK_NO from WEEK_OF_YEAR(S.TOTAL_DAY_SELLING)) WEEK,
> > S.SELLING_DATE,
> > sum(S.TOTAL_DAY_SELLING)
> > from SELLINGS S
> > group by 1, 2
> >
> > Thanks,
> > Carlos Macao
> >
>