Re: query, probably needs window functions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: query, probably needs window functions
Date: 2020-05-22 20:10:46
Message-ID: CAKFQuwZN54-whR79O7sJx8p60YzpLjD7Xo8CP3oXWwwySSzHVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 22, 2020 at 12:38 PM Michael Lewis <mlewis(at)entrata(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2020-05-22 22:15:59 Re: Help understanding SIReadLock growing without bound on completed transaction
Previous Message Michael Lewis 2020-05-22 19:37:59 Re: query, probably needs window functions