我正在使用以下查询来获取“预测”:
(select ROUND(sum(abs(l.piece))/count(distinct trunc(l.date_p)))*12
from vu_turnover l, orders_l cl where
regexp_replace(l.rid_v, '!.*', '') = cl.rid
and cl.user = 46 -- not_stock_price
and TO_CHAR(l.date_p,'W') = TO_CHAR(SYSDATE,'W') -- current_week
and l.date_p >= add_months(trunc(sysdate, 'YEAR'), -12) -- last_year
and l.code_id = item.id
and Substr(cl.flags_s, 12, 1 ) = 2 -- executed_order
and l.code_o IS NOT NULL and l.partner in (X,Y))
它工作正常,并返回-average of all piece which was sold through the current week(1-4) in the month at last + current year
的值。它乘以12。
表vu_turnover
看起来像这样(它与orders_l
相关联):
orders_id code_o date_p partner piece code_id l.rid_v
00000123 01 01.01.2018 XY 5 2789 000014!03
00000124 01 01.01.2018 XY 5 2789 000014!03
00000125 01 12.02.2018 XY 10 2789 000015!08
00000128 01 24.03.2018 XY 5 2789 000034!05
00000129 01 05.05.2018 XY 10 2789 000119!09
在表中是按ID-s的每日销售额。
是否有更好的IDEA可以对未来12天进行预测?
答案 0 :(得分:2)
在Oracle中有两种可能性-您可以使用:
除非您有固定的时间序列,否则平均法不是很好。