— 新增付费
drop table member_time_orders_temp;
create table member_time_orders_temp
select m.id
from
member_time_orders m
where
(
(m.date >= ‘2015-10-01’ and m.date < ‘2015-12-01’)
)
and not EXISTS(select 1 from member_time_orders bm where bm.member_id = m.member_id and bm.date < m.date limit 1)
group by m.date,m.member_id;
select month(m.date) as the_month,m.channel_name,count(DISTINCT m.member_id) as num
from
member_time_orders m
inner join member_time_orders_temp t ON m.id = t.id
group by the_month,m.channel_name;
— 渠道激活
select month(date) as the_month,SUBSTRING_INDEX(client_version,’.’,-1) as qd,
ifnull(count(distinct id),0) as num
from active_clients
where date >=’2015-10-01′ and date <‘2015-12-01’
group by the_month,qd