Re: query, probably needs window functions - Mailing list pgsql-general

From David G. Johnston
Subject Re: query, probably needs window functions
Date
Msg-id CAKFQuwZN54-whR79O7sJx8p60YzpLjD7Xo8CP3oXWwwySSzHVQ@mail.gmail.com
Whole thread Raw
In response to Re: query, probably needs window functions  (Michael Lewis <mlewis@entrata.com>)
List pgsql-general
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')

David J.

pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: query, probably needs window functions
Next
From: Thomas Munro
Date:
Subject: Re: Help understanding SIReadLock growing without bound on completed transaction