Subject Aggregation and selectable SP
Author Carlos Macao
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