我正在尝试使用我的事务表汇总PHP MySQL查询:
transaction_id customer_id transaction_order_date
-------------- ----------- ----------------------
1001 1 2014-05-01 10:00:00
1002 1 2014-05-01 11:00:00
1003 2 2014-05-02 10:00:00
1004 2 2014-05-03 10:00:00
1005 1 2014-05-03 10:00:00`
我希望得到这样的结果:
customer_id 1 avg_time_trans 18920(in second) customer_id 2 avg_time_trans 12220(in second)