select on many-to-many relationship

From: ssylla <stefansylla(at)gmx(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: select on many-to-many relationship
Date: 2012-11-27 10:13:51
Message-ID: 1354011231922-5733696.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear list,

assuming I have the following n:n relationship:

t1:
id_project
1
2

t2:
id_product
1
2

intermediary table:
t3
id_project|id_product
1|1
1|2
2|1

How can I create an output like this:
id_project|id_product1|id_product2
1|1|2
2|1|NULL

--
View this message in context: http://postgresql.1045698.n5.nabble.com/select-on-many-to-many-relationship-tp5733696.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Willem Leenen 2012-11-27 11:44:24 Re: Using regexp_matches in the WHERE clause
Previous Message Marcin Krawczyk 2012-11-27 10:01:00 Re: locks problem