分組結果給了我兩列的輸出:SQL - 通過下面的查詢總計
Day Num_Users_Retained
0 209312
1 22139
2 11457
等等,所有的。不過我想天的方式爲259(每天在2012年) 0將num_users_retained中所有值的總和包含在0到259之間,然後我希望第1天包含1-259中所有值的總和,依此類推,直到我到達最後一天。這裏是原來的查詢:
--Retention since January 1,2012--
select retention as Day,count(retention) as Num_Users_Retained
from (select player_id,round(init_dtime-create_dtime,0) as retention
from player
where Trunc(Create_Dtime) >= To_Date('2012-jan-01','yyyy-mon-dd')
and init_dtime is not null)
Group by retention
order by 1
有什麼建議嗎?
非常接近,我只是稍微編輯了我用來查詢運行的內容。非常感謝。 – Americo