复购率

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span><pre name="code" class="html">SELECT *,
count(temp2.uid) as 复购人数
FROM(
SELECT m.*, temp.merchantId, temp.uid
FROM merchant m,(
SELECT order1.merchantId, order1.uid
FROM `order` order1
WHERE order1.uid IN(
SELECT DISTINCT(o.uid)
FROM `order` o
WHERE DATE(o.createDate)>= DATE('2015-10-06 00:00:00')
AND DATE(o.createDate)<= DATE('2015-10-13 23:59:59')
AND o. STATUS>= 3
AND o. STATUS<= 6
AND o.merchantId= order1.merchantId)
AND DATE(order1.createDate)>= date('2015-10-14 00:00:00')
AND DATE(order1.createDate)<= DATE('2015-10-21 23:59:59')
AND order1. STATUS>= 3
AND order1. STATUS<= 6) AS temp
WHERE temp.merchantId= m.id
GROUP BY temp.merchantId, temp.uid
HAVING count(*)>= 6) AS temp2
GROUP BY temp2.id

 计算的是一段时间的在后面一个时间段重复购买的人数(不重复)

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值