select dept_code,
emp_code ,
COMMISSION_month,
emp_convert_time,
sum(emp_commis_money)
from TR_TCAS_DEPOT_COMMISSION_EMP
GROUP BY dept_code, emp_code, COMMISSION_month, emp_convert_time
GROUP BY
select t.*
from TT_TCAS_HUBPBS_HUB_EMP_INFO t
where dept_code = '020WD'
and work_date >= to_date('2015-05-01', 'yyyy-mm-dd')
and work_date < to_date('2015-06-01', 'yyyy-mm-dd');
select t.*
from TT_TCAS_HUBPBS_HUB_EMP_INFO t
where dept_code = '020WD'
and work_date >= to_date('2015-05', 'yyyy-mm')
and work_date < to_date('2015-06', 'yyyy-mm');
select t.*, t.rowid
from ccw_push_record t
WHERE T.ALI_USERID IN
('C506A88839298CACB345D076DEAF78A9',
'gill3brKJHdAPjlDtEuhQWcTDbmpvKZWm7oa +
WtN3mUQCYxETDvGao + ZLzOHbRwk01')
AND T.CREATE_TM > to_date('2016-01-25', 'yyyy-mm-dd')
order BY T.CREATE_TM DESC;
merge into (select * from CCWP_QUDAO_HMD where phone is null) d
using (with group1 as (select max(m.id) id,
m.ALIPAY_UID,
m.bind_status,
max(m.bind_status) over(partition by m.ALIPAY_UID) maxStatus
from tlc_alipay_phone_bind m
group by m.ALIPAY_UID, m.bind_status)
select b.*
from group1 g
join tlc_alipay_phone_bind b on g.id = b.id
where g.maxStatus = g.bind_status) s on (d.alipay_uid = s.ALIPAY_UID) when matched then
update
set d.phone = s.phone,
d.alipay_publicid = s.ALIPAY_PUBLICID,
d.falg = 1,
d.creator = 'admin',
d.creattm = sysdate,
d.updator = 'admin',
d.updatetm = sysdate;
commit;
--------------重复数据查询-------------------------
select t.push_type,t.bno,t.order_channel,max(t.create_tm),min(t.create_tm),count(1)
from ccw_push_record t
where t.push_type in ('2', '3', '4')
and trunc(sysdate-2) < t.create_tm
and t.create_tm < trunc(sysdate-1)
group by t.push_type,t.bno,t.order_channel having(count(1))>1