select rolegroupdescription 组名,staffname 坐席名,
count(case when userdefinedstatus is not null then 1 end ) 外拨总量,
count(case when userdefinedstatus='99998' then 1 end )赠险未成功,
count(case when userdefinedstatus='99999' then 1 end )赠险成功,
count(case when userdefinedstatus='100000' then 1 end )付费险活动通知,
count(case when userdefinedstatus='100001' then 1 end )产品促成,
count(case when userdefinedstatus='100002' then 1 end )登记稳单,
count(case when userdefinedstatus='100003' then 1 end )成交维护
from
( select c.customer_guid ,t.STATUSCHDATE,t.userdefinedstatus,s.staffname,r.rolegroupdescription,c.callbacklist,(ROW_NUMBER()OVER(PARTITION BY c.customer_guid ORDER BY t.STATUSCHDATE DESC)) RK
from TABCCONTACTHIS t
join event e on e.event_guid = t.eventid
join customer c on e.customer_guid = c.customer_guid
join staff s on s.staff_id = c.owner
join staffrolegroup sr on sr.staff_id = s.staff_id
join rolegroup r on r.rolegroup_id = sr.rolegroup_id
join custlists cu on cu.custlist_xxx = c.callbacklist
where t.statuschdate > cu.createddate
AND S.WORKSTATUS = 'ONLINE'
) ZZ
where rk = 1
GROUP BY rolegroupdescription,staffname
ORDER BY rolegroupdescription,staffname
想添加个时间条件,得到的结果只有今天的。就是0点到现在。 t.statuschdate 为时间字段
求高手
PL/SQL添加时间条件
答案:3 悬赏:40 手机版
解决时间 2021-01-27 02:35
- 提问者网友:佞臣
- 2021-01-26 15:58
最佳答案
- 五星知识达人网友:七十二街
- 2021-01-26 16:25
to_char(t.statuschdate,'yyyymmdd') =to_char(sysdate,'yyyymmdd')这句加到你where条件里
全部回答
- 1楼网友:过活
- 2021-01-26 18:07
这个好像是mssql哦,试试下面的增加了一句时间条件
select rolegroupdescription 组名,staffname 坐席名,
count(case when userdefinedstatus is not null then 1 end ) 外拨总量,
count(case when userdefinedstatus='99998' then 1 end )赠险未成功,
count(case when userdefinedstatus='99999' then 1 end )赠险成功,
count(case when userdefinedstatus='100000' then 1 end )付费险活动通知,
count(case when userdefinedstatus='100001' then 1 end )产品促成,
count(case when userdefinedstatus='100002' then 1 end )登记稳单,
count(case when userdefinedstatus='100003' then 1 end )成交维护
from
( select c.customer_guid ,t.STATUSCHDATE,t.userdefinedstatus,s.staffname,r.rolegroupdescription,c.callbacklist,(ROW_NUMBER()OVER(PARTITION BY c.customer_guid ORDER BY t.STATUSCHDATE DESC)) RK
from TABCCONTACTHIS t
join event e on e.event_guid = t.eventid
join customer c on e.customer_guid = c.customer_guid
join staff s on s.staff_id = c.owner
join staffrolegroup sr on sr.staff_id = s.staff_id
join rolegroup r on r.rolegroup_id = sr.rolegroup_id
join custlists cu on cu.custlist_xxx = c.callbacklist
where t.statuschdate > cu.createddate
AND S.WORKSTATUS = 'ONLINE'
and convert(varchar(20),t.statuschdate,112)=convert(varchar(20),getdate(),112)
) ZZ
where rk = 1
GROUP BY rolegroupdescription,staffname
ORDER BY rolegroupdescription,staffname
- 2楼网友:煞尾
- 2021-01-26 17:46
declare
v_hiredate emp.hiredate%type:=to_date('&输入出生日期','yyyy-mm-dd');
begin
insert into emp hiredate values v_hiredate;
end;
在oracle中,date类型都是带时间的,如果吧一个具体的日期(获时间)赋给一个日期型变量,如果是当前时刻:vdate := sysdate;就可以,否则只能用to_date函数。常用格式:年-月-日 时:分:秒 'yyyy-mm-dd hh:mi:ss';年月日:'yyyy-mm-dd'。其他以此类推。注意:月必须用m,分必须用mi
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯