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

From Scott Ribe
Subject query, probably needs window functions
Date
Msg-id 037A65BF-4CFE-4EC0-A037-173C9DDF2A9C@elevated-dev.com
Whole thread Raw
Responses Re: query, probably needs window functions
List pgsql-general
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
showingblanks for those columns? I'm guessing that window functions provide this capability, but I don't know how. 

--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/






pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: How to get the OID of a view
Next
From: "David G. Johnston"
Date:
Subject: Re: query, probably needs window functions