On Fri, May 22, 2020 at 12:38 PM Michael Lewis <mlewis@entrata.com> wrote:
I believe something like this is what you want. You might be able to do it without a sub-query by comparing the current name value to the lag value and null it out if it's the same.
This. I misread the question. You might also consider just outputting one row per person and output the related phone numbers using string_agg(phone.number, E'\n')