pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>
To: pgsql-sql@postgresql.org
Subject: list variable attributes in one select
Date: Mon, 22 Jan 2007 08:43:48 +0100
Message-ID: <20070122074348.GA8177@apartia.fr> (raw)

Hello,

I've got the following tables:

person:
- id_person
- firstname
- lastname
- type

person_to_type:
- id_person references person
- type references person_type;

person_type:
- type

"person_type" contains differents caracteristics for a person (actor, 
director, author, etc.) who can have several types, hence the need for 
the person_to_type table.

I'd like to know if I can list in one SELECT command a person and all of 
its types, given that the number of types can be 0 to n.

For example, for a given person I'd like to obtain:

"John Doe", "actor", "playright", "author"

or 

"Jane Doe", "director"

in one select.

Is that possible?




view thread (2+ messages)  latest in thread

Message-ID: <20070122074348.GA8177@apartia.fr>
Permalink:  ../20070122074348.GA8177@apartia.fr/
Also on:    postgresql.org/message-id/20070122074348.GA8177@apartia.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vindex+lists-pgsql-sql@apartia.org
  Subject: Re: list variable attributes in one select
  In-Reply-To: <20070122074348.GA8177@apartia.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox