计算每个客户的两次订单之间的平均时间 [英] Calculating the average time between orders for each customer

查看:107
本文介绍了计算每个客户的两次订单之间的平均时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经进行了全面搜索,但似乎无法找到如何计算每个客户的两次订单之间的平均时间.我正在使用Oracle SQL Developer.香港专业教育学院试图没有高兴地使用lag()函数.

I've searched all over but cant seem to find how to calculate the average time between orders for each customer. I'm using Oracle SQL Developer. Ive tried using the lag() function with no joy.

以下示例数据显示了在3个不同情况下购买的客户.所有购买之间的平均时间为7.5天((6 + 9)/2).

Example data below shows a customer bought on 3 separate occasions. The average time between all purchases is 7.5 days ((6+9)/2).

CustID   OrderDate 
-------  ---------
1000000  14-AUG-12
1000000  23-AUG-12
1000000  29-AUG-12

那么我该如何计算每个客户的平均值?

So how do I calculate that average for each customer?

任何帮助将不胜感激.

推荐答案

此处的关键是 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆