Re: query, probably needs window functions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: query, probably needs window functions
Date: 2020-05-22 18:34:55
Message-ID: CAKFQuwaxjJpoUNtNKzDDg0ujJP9Qr+UL2baug8kuFmd4EPnnng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday, May 22, 2020, Scott Ribe <scott_ribe(at)elevated-dev(dot)com> wrote:

> given, let's say:
>
> create table person (id int not null, name varchar);
> create table phone (id int not null, person_id int not null, number
> varchar);
>
> select person.*, phone.number from person join phone on (person.id =
> phone.person_id) order by...
>
> How would you get results where only the first row for a person was filled
> in, with rest of that person's phones showing blanks for those columns? I'm
> guessing that window functions provide this capability, but I don't know
> how.
>
>
If a left join doesn’t give you the answer you want you should probably
provide exact input and output data that you are working with/toward.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2020-05-22 18:54:34 Re: Query returns no rows in pg_basebackup cluster
Previous Message Scott Ribe 2020-05-22 18:30:02 query, probably needs window functions