Teradata 显示列表中出现次数超过 10 次的人员
Teradata Show people who have over 10 occurrences on the list
我需要一些帮助来解决这个问题。请参阅下面的 Teradata 查询。我只是想向那些在 60 秒内有 10 次或更多次呼叫的人(l_name、f_name)展示。例如,如果一个人在 60 秒内有 9 次通话,则这些记录中的 none 会出现在结果中。但是,如果它们出现 11 次,则所有 11 条记录都会出现在结果中。
select
group_name, device_id as record, starttime, length, csr_id,
f_name, l_name, sum(score), sum(poss_score), Manager,
case
when gro.name in ('Group A’) then 'Group 1’
when gro.name in ('Group B’) then 'Group 2’
when gro.name in ('Group c’) then 'Group 3’
else gro.name
end as Group_Name
from
rep_voice re
left join
qa_complete com on re.record_ck = com.record_ck
join
users_groups us on us.user_ck = re.user_ck and us.current = 1
where
cast(re.starttime as date) between TRUNC((CURRENT_DATE-7)) and LAST_DAY((CURRENT_DATE-1))
and duration<= 60
and name in ('ABCD','EFGH','IJKL','LMNO')
qualify rank () over (partition by us.user_ck order by cast (us.modifiedon as date) desc) =1
group by
1,2,3,4,5,6,7,9,us.user_ck,us.modifiedon
我并不完全熟悉您的架构布局 - 正如 Gordon 提到的那样 - 但我认为您正在寻找的是:
select * from call_table
qualify count(*) over (partition by user_caller)>=10
我需要一些帮助来解决这个问题。请参阅下面的 Teradata 查询。我只是想向那些在 60 秒内有 10 次或更多次呼叫的人(l_name、f_name)展示。例如,如果一个人在 60 秒内有 9 次通话,则这些记录中的 none 会出现在结果中。但是,如果它们出现 11 次,则所有 11 条记录都会出现在结果中。
select
group_name, device_id as record, starttime, length, csr_id,
f_name, l_name, sum(score), sum(poss_score), Manager,
case
when gro.name in ('Group A’) then 'Group 1’
when gro.name in ('Group B’) then 'Group 2’
when gro.name in ('Group c’) then 'Group 3’
else gro.name
end as Group_Name
from
rep_voice re
left join
qa_complete com on re.record_ck = com.record_ck
join
users_groups us on us.user_ck = re.user_ck and us.current = 1
where
cast(re.starttime as date) between TRUNC((CURRENT_DATE-7)) and LAST_DAY((CURRENT_DATE-1))
and duration<= 60
and name in ('ABCD','EFGH','IJKL','LMNO')
qualify rank () over (partition by us.user_ck order by cast (us.modifiedon as date) desc) =1
group by
1,2,3,4,5,6,7,9,us.user_ck,us.modifiedon
我并不完全熟悉您的架构布局 - 正如 Gordon 提到的那样 - 但我认为您正在寻找的是:
select * from call_table
qualify count(*) over (partition by user_caller)>=10