したがって、2つの異なる日付を保持するテーブルがあり、次の間の分の差を選択しています。
select customerID, customers.telNumber,
sum(round((enddate - startdate) * 1440)) over (partition by telNumber) total_mins
from table;
その後、分数が最も多い上位5つだけを取得したいと思います。
rank() over (partition by total_mins order by total_mins)
どうやってそれをやろうか?