Subject | Re: Aggregation and selectable SP |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-12-12T10:06:09Z |
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
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 number,
> how can I do this sum on a selectable SP?
>
> 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 speed
> 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
>