Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テーブルを仮定しorderます: user_id, order_id, created (timestamp), ...
order
user_id, order_id, created (timestamp)
1 人のユーザーの後続の注文間の平均時間間隔を計算する方法は? (ユーザーが注文を作成する頻度は?)
select case when count(order_id) = 0 then -1 else (max(created) - min(created)) / count(order_id) end as avg_order_time from `order` where user_id = 123