SQL

来源:互联网 发布:mac迅雷无法登陆 编辑:程序博客网 时间:2024/06/03 20:54
count( distinct case when sms_content='6' and usr_brand='1000' then  send_nbr else null end) as 积分兑换不重复量,
count(case when sms_content='6' and usr_brand='1000' then  send_nbr else null end) as 积分兑换总量,
count( distinct case when recv_nbr='10086888' then  send_nbr else null end) as 入网中奖不重复,
count(case when recv_nbr='10086888' then  send_nbr else null end) as 入网中奖总量,
count( distinct sms_content like '%20*%' and recv_nbr='10086'  send_nbr else null end) as 营销活动不重复,
count(case when sms_content like '%20*%' and recv_nbr='10086' then  send_nbr else null end) as 营销活动总量
from smbh_sms_recv_log
where recv_time>=to_date('20070401 00:00:01','yyyymmdd hh24:mi:ss')
and recv_time<=to_date('20070514 23:59:59','yyyymmdd hh24:mi:ss')
and home_city in ('591','592','593','594','595','596','597','598','599')
group by home_city [/B]
原创粉丝点击