所需的输出为每一行保留前两个"列",并在同一行上添加"word"的出现次数.
输入:
string1 string2 aaaaaaaaa word aaaaaaaa word
string3 string4 ccccccccccc word dddaaaaaaacccd word dddddaaaaa word bbbb
string5 string6 aaaa word bbbbbbaddd word aaaaa word ccccccdddddddddd word cccccc
Run Code Online (Sandbox Code Playgroud)
期望的输出:
string1 string2 2
string3 string4 3
string5 string6 4
Run Code Online (Sandbox Code Playgroud)
有什么建议?
从EMPLOYEE表中,我想对记录数量(雇用的员工)进行分组,并且每天运行TOTAL.输入的格式如下:
rownum Hired_date_time 1 1/10/2012 11:00 2 1/10/2012 13:00 3 20/11/2012 10:00 4 20/11/2012 15:00 5 20/11/2012 16:00 6 30/12/2012 1:00
所需的输出:
Hired_date.......Hired_per_day.........TOTAL_number_of_employees 1/10/2012 ...................2 ........2 20/11/2012 ..................3 ........5 30/12/2012 ..................1 ....... 6
GROUPING PERDAY没问题:
select trunc(Hired_date_time) as "Hired_date" ,
count(*) as "Hired_per_day"
from employee
group by trunc(Hired_date_time)
order by trunc(Hired_date_time);
Run Code Online (Sandbox Code Playgroud)
问题:如何使用窗口函数获得总计(在最后一列中)