计算每个客户的两次订单之间的平均时间

问题描述:

我已经进行了全面搜索,但似乎无法找到如何计算每个客户的两次订单之间的平均时间.我正在使用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?

任何帮助将不胜感激.

此处的关键是 查看全文