数据统计

按照时间统计各个阶段的数据数量

1.统计每个月卖家的注册数量

select DATE_FORMAT(create_time,'%Y-%m') as month,count(merchantid) as count
from usr_seller where
merchantid not in (
SELECT t.merchant_id from usr_test_users t WHERE t.merchant_id is not null
) and
DATE_FORMAT(create_time,'%Y')=2016 group by month order by month desc


2.统计过去12个月的卖家数据

select DATE_FORMAT(t.create_time,'%Y-%m') month,count(t.merchantid) as count
from usr_business_info_history t
where merchantid not in (
SELECT t.merchant_id from usr_test_users t WHERE t.merchant_id is not null
) and
DATE_FORMAT(create_time,'%Y-%m')> DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m')
group by month ORDER BY month desc

参考:
[url]http://linkyou.blog.51cto.com/1332494/751980/[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值