X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8657914B281B for ; Wed, 11 Aug 2004 13:45:06 -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 23760-01 for ; Wed, 11 Aug 2004 16:45:04 +0000 (GMT) Received: from mailgate3.cinetic.de (mailgate3.cinetic.de [217.72.192.164]) by svr1.postgresql.org (Postfix) with ESMTP id 533AF14B2800 for ; Wed, 11 Aug 2004 13:45:01 -0300 (ADT) Received: from exchange02.int.cinetic.de (exchange02.int.cinetic.de [10.2.1.12]) by mailgate3.cinetic.de (8.11.6p2/8.11.2/SuSE Linux 8.11.0-0.4) with ESMTP id i7BGivK03092; Wed, 11 Aug 2004 18:44:57 +0200 Received: from webde-ag.de ([10.1.8.177]) by exchange02.int.cinetic.de with Microsoft SMTPSVC(6.0.3790.0); Wed, 11 Aug 2004 18:44:57 +0200 Message-ID: <411A4D09.2040500@webde-ag.de> Date: Wed, 11 Aug 2004 18:44:57 +0200 From: Michael Kleiser Organization: WEB.DE AG User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.3.1) Gecko/20030425 X-Accept-Language: de, de-at, en, en-us MIME-Version: 1.0 To: David Garamond Cc: pgsql-sql@postgresql.org Subject: Re: Displaying two tables side by side References: <411A2926.9020500@zara.6.isreserved.com> In-Reply-To: <411A2926.9020500@zara.6.isreserved.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Aug 2004 16:44:57.0170 (UTC) FILETIME=[88FA3B20:01C47FC2] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/88 X-Sequence-Number: 18585 select ( select a from t1 where CAST(t1.oid AS int) - CAST( (select min(oid) from t1) AS int ) = t_all.rownum ) AS a , ( select b from t1 where CAST(t1.oid AS int) - CAST( (select min(oid) from t1) AS int ) = t_all.rownum ) AS a , ( select c from t2 where CAST(t2.oid AS int) - CAST( (select min(oid) from t2) AS int ) = t_all.rownum ) AS a , ( select d from t2 where CAST(t2.oid AS int) - CAST( (select min(oid) from t2) AS int ) = t_all.rownum ) AS a from ( select cast(t1.oid AS int) - CAST( (select min(oid) from t1) AS int ) AS rownum UNION select cast(t2.oid AS int) - CAST( (select min(oid) from t2) AS int ) AS rownum ) AS t_all; a | a | a | a ---+---+---+--- 2 | 2 | 4 | 5 3 | 5 | 7 | 3 4 | 7 | 3 | 2 9 | 0 | 1 | 1 | | 2 | 0 David Garamond schrieb: > How can you display two tables side by side? Example: > > > select * from t1; > a | b > ---+--- > 2 | 2 > 3 | 5 > 4 | 7 > 9 | 0 > > > select * from t2; > c | d > ---+--- > 4 | 5 > 7 | 3 > 3 | 2 > 1 | 1 > 2 | 0 > > Intended output: > a | b | c | d > ---+---+---+--- > 2 | 2 | 4 | 5 > 3 | 5 | 7 | 3 > 4 | 7 | 3 | 2 > 9 | 0 | 1 | 1 > | | 2 | 0 > > Each table has no keys (and no OIDs). Order is not important, but each > row from each table needs to be displayed exactly once. > > -- > dave > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster