• 欢迎访问小杰博客网站
  • 欢迎访问小杰博客网站哦

新增付费、渠道激活统计sql

未分类 小杰 8年前 (2015-12-17) 1220次浏览 已收录 0个评论

— 新增付费

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


小杰博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:新增付费、渠道激活统计sql
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址