【问题标题】:Teradata Show people who have over 10 occurrences on the listTeradata 显示列表中出现超过 10 次的人员
【发布时间】:2020-05-08 02:20:47
【问题描述】:

我需要一些帮助来解决这个问题。请参阅下面的 Teradata 查询。我只是想展示在 60 秒内有 10 次或更多次呼叫的人(l_name,f_name)。例如,如果一个人在 60 秒内有 9 次呼叫,则这些记录都不会出现在结果中。但是,如果它们出现 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

【问题讨论】:

  • 我理解你的问题。但我不知道查询与它有什么关系。样本数据和期望的结果会很有帮助。

标签: sql reporting-services teradata teradata-sql-assistant


【解决方案1】:

我并不完全熟悉您的架构布局 - 正如 Gordon 提到的那样 - 但我认为您正在寻找的是:

select * from call_table
qualify count(*) over (partition by user_caller)>=10

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-06
    • 2020-10-29
    • 1970-01-01
    • 2021-12-20
    相关资源
    最近更新 更多