我在PLSQL工作,尝试查找给定周的事件计数,按日和小时细分。
基本上我想插入一周,然后计算一些事件,以便我能够轻松识别每天1M> 300k /小时(= GOLD),每天500k和每小时200k(银)的数量,每天100k每小时30k。
我正在尝试这样的事情来获取每天的数据,但我不知道如何每小时,每小时分解它。甲骨文新秀在这里。
CefRefPtr<CefV8Value> returnValue;
CefRefPtr<CefV8Exception> exception;
context->Eval("new CustomEvent('test');", returnValue, exception);
任何我可以投入excel并执行计数的东西都适合我
任何帮助表示赞赏
答案 0 :(得分:0)
让我知道它是否有帮助:
SELECT T.*,
CASE WHEN CNT_PER_DAY > ... AND CNT_PER_HOUR > ... THEN 'GOLD'
WHEN CNT_PER_DAY > ... AND CNT_PER_HOUR > ... THEN 'SILVER'
WHEN CNT_PER_DAY > ... AND CNT_PER_HOUR > ... 'BRONZE'
ELSE ...
END CATEGORY
FROM (
SELECT DISTINCT
Identifier,
TO_CHAR(TRUNC(store.transaction_datetime, 'HH'), 'DD-MON-YYYY HH24:MI:SS') HOUR_TIME,
COUNT (*) OVER (PARTITION BY Identifier,TRUNC(store.transaction_datetime, 'HH')) CNT_PER_HOUR,
TO_CHAR(TRUNC(store.transaction_datetime, 'DD'), 'DD-MON-YYYY HH24:MI:SS') DAY_TIME,
COUNT (*) OVER (PARTITION BY Identifier,TRUNC(store.transaction_datetime, 'DD')) CNT_PER_DAY,
store.transaction_datetime
FROM data.stats store
WHERE store.transaction_datetime >= '2016-09-04 00:00:00'
AND store.transaction_datetime <= '2016-09-10 23:59:59') T
ORDER BY TO_CHAR (TRUNC (T.transaction_datetime, 'HH'), 'DD-MON-YYYY HH24:MI:SS') ASC;