--- Michael Glaesemann wrote:
> SELECT DISTINCT ON (phone_number)
> phone_number, call_duration, id
> FROM calls
> ORDER BY phone_number
> , call_duration DESC;
Wasn't acquainted with "DISTINCT ON (column)".
I found it to be many times faster than other suggestions using JOIN.
Cheers,
Fernando.