使用Stats_mode显示最频繁的值,然后显示最频繁的值

时间:2018-10-23 22:24:59

标签: oracle

我正在尝试建立一个报告,以小时为单位显示行选择,选择最多的用户名,以及完成最高选择器的选择数。该报告几乎完成,除了最高选择者的选择数量。

select 
to_char(adddate, 'HH24') AS HOUR,
count(*) AS TOTAL_PICKS,
STATS_MODE(addwho) AS BEST_PICKER,
Count(3) as NumOfPICKS
from ITRN_DW
WHERE TRANTYPE = 'MV' and storerkey ='4045'
AND  SOURCETYPE = 'PICKING'
AND TRUNC(ADDDATE) = TO_DATE ('&1', 'MM/DD/YYYY')
group by  to_char(adddate, 'HH24')
order by  to_char(adddate, 'HH24')

0 个答案:

没有答案