短信数据提取:
select t1.ORG_NAME as'调解组',t1.collector_name as'调解员',DATE_FORMAT(t1.SEND_DATE,'%Y-%m-%d') as'发送日期',
sum(case when t1.SEND_CHANNEL='MANUAL_SEND' then 1 else 0 end) as '单独发送',
sum(case when t1.SEND_CHANNEL='BATCH_MANUAL_SEND' then 1 else 0 end) as '批量发送',
count(t1.PRODUCT_CUSTOMER_ID) as '短信发送总量'
from (
select * ,
AES_DECRYPT(UNHEX(TEL_NO), UNHEX('e3a391d917e642c2deb41f2f1ad61e4d9653cdada817759efdb03715b87a9052')) as '手机号'#这边是一个加密转换的函数AES_DECRYPT(UNHEX(TEL_NO), UNHEX()电话号码转化
from ceres_sms_work
where
PARTNER_USER_ID in ('58f75b3f66cd5b0d',
'c30d02fa114f7305',
'c30d02fa114f7305',
'bc6350b11c476c23',
'5e9c42e68394238f',
'43173e4fa4264760',
'39d41693bd93c45c',) and SEND_DATE>=DATE_FORMAT('2022-11-21','%Y-%m-%d 00:00:00') and SEND_DATE<=DATE_FORMAT('2022-11-21','%Y-%m-%d 23:59:59')) t1
group by t1.ORG_NAME,t1.collector_name,DATE_FORMAT(t1.SEND_DATE,'%Y-%m-%d')
order by DATE_FORMAT(t1.SEND_DATE,'%Y-%m-%d'),t1.ORG_NAME
;