X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 37EA4531C8; Mon, 14 Mar 2005 02:43:21 +0000 (GMT) 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 36082-05; Mon, 14 Mar 2005 02:43:19 +0000 (GMT) Received: from mailhub1.une.edu.au (mailhub.une.edu.au [129.180.1.122]) by svr1.postgresql.org (Postfix) with ESMTP id CDEEF52A56; Mon, 14 Mar 2005 02:43:17 +0000 (GMT) Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) by mailhub1.une.edu.au (Postfix) with ESMTP id CF45E7EB0; Mon, 14 Mar 2005 13:43:21 +1100 (EST) Received: from kgb ([129.180.47.225]) by icarus.une.edu.au (8.12.8/8.12.8) with SMTP id j2E2hIG7012277; Mon, 14 Mar 2005 13:43:21 +1100 Date: Mon, 14 Mar 2005 13:44:51 +1100 From: Klint Gore To: Steven Verhoeven Cc: pgsql-general@postgresql.org, pgsql-novice@postgresql.org Subject: Re: sql question In-Reply-To: <423190C1.5090406@dmbr.UGent.be> References: <423190C1.5090406@dmbr.UGent.be> Message-Id: <4234FAA316C.5233KG@129.180.47.120> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver 1.25.06 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/575 X-Sequence-Number: 74890 On Fri, 11 Mar 2005 13:36:17 +0100, Steven Verhoeven wrote: > Hi all > > My table definition : > > id | fref | mref > ------+-----------+---------- > 1 | 23 | 25 > 2 | 24 | 28 > 3 | 25 | 31 > 4 | 26 | 34 > > My problem : > i need a query that results in this : > > id | ref > ------+---------- > 1 | 23 > 1 | 25 > 2 | 24 > 2 | 28 > 3 | 25 > 3 | 31 > 4 | 26 > 4 | 34 > > > Do I need a crosstab-query ? select id, fref from mytable union all select id, mref from mytable order by 1,2 klint. +---------------------------------------+-----------------+ : Klint Gore : "Non rhyming : : EMail : kg@kgb.une.edu.au : slang - the : : Snail : A.B.R.I. : possibilities : : Mail University of New England : are useless" : : Armidale NSW 2351 Australia : L.J.J. : : Fax : +61 2 6772 5376 : : +---------------------------------------+-----------------+