X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AE5FDA864 for ; Thu, 22 Sep 2005 14:29:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71364-10 for ; Thu, 22 Sep 2005 17:29:40 +0000 (GMT) Received: from mail47-s.fg.online.no (mail47-s.fg.online.no [148.122.161.47]) by svr1.postgresql.org (Postfix) with ESMTP id E922DDAA75 for ; Thu, 22 Sep 2005 14:29:38 -0300 (ADT) Received: from [192.168.0.57] (062016183238.customer.alfanett.no [62.16.183.238]) by mail47.fg.online.no (8.12.11/8.12.11) with ESMTP id j8MHTa6s019987 for ; Thu, 22 Sep 2005 19:29:37 +0200 (CEST) From: "Leif B. Kristensen" To: pgsql-sql@postgresql.org Subject: Help with a view Date: Thu, 22 Sep 2005 19:29:35 +0200 User-Agent: KMail/1.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509221929.36043.leif@solumslekt.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.076 required=5 tests=[AWL=0.076] X-Spam-Level: X-Archive-Number: 200509/208 X-Sequence-Number: 22755 I've created a view 'principals' that gives me this output: pgslekt=> select * from principals where event=15821; person | event | place | sort_date | tag_type --------+-------+-------+------------+---------- 2 | 15821 | 1152 | 1999-09-17 | 4 3 | 15821 | 1152 | 1999-09-17 | 4 (2 rows) How do I go about selecting the "other" person of this event, given that I have one of them and the event number? I'd also like a view that gives me the two rows combined into one, with "person" replaced by p1 and p2. -- Leif Biberg Kristensen http://solumslekt.org/