X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D6F4A11F602A for ; Fri, 28 Apr 2006 12:31:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 46790-04 for ; Fri, 28 Apr 2006 12:31:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id DB22211F60B8 for ; Fri, 28 Apr 2006 12:31:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3SFVAni001268; Fri, 28 Apr 2006 11:31:10 -0400 (EDT) To: emils.klotins@gmail.com cc: pgsql-sql@postgresql.org Subject: Re: Outer joins? In-reply-to: <9dcb6fa40604280623h6f353153y@mail.gmail.com> References: <9dcb6fa40604280623h6f353153y@mail.gmail.com> Comments: In-reply-to Emils message dated "Fri, 28 Apr 2006 16:23:53 +0300" Date: Fri, 28 Apr 2006 11:31:10 -0400 Message-ID: <1267.1146238270@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/204 X-Sequence-Number: 25013 Emils writes: > The table structure is: > object_values > ========== > obj_id > att_id > value > namely, each object can have arbitrary number of attributes each of > them with a value. > What I want, is a simple table of objects with some of their specific > attributes, the result should be in form: > obj_id1 o1att1_value o1att2_value o1att3_value > obj_id2 o2att1_value o2att2_value o2att3_value > ... This isn't an outer-join problem, it's a crosstab problem. Try the crosstab functions in contrib/tablefunc. regards, tom lane