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 A228056716 for ; Mon, 14 Mar 2005 02:38:30 +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 33711-09 for ; Mon, 14 Mar 2005 02:38:25 +0000 (GMT) Received: from smtp.inreach.com (209-142-2-36.stk.inreach.net [209.142.2.36]) by svr1.postgresql.org (Postfix) with SMTP id 282105657B for ; Mon, 14 Mar 2005 02:34:48 +0000 (GMT) Received: (qmail 16661 invoked from network); 14 Mar 2005 02:46:39 -0000 Received: from [209.239.173.94] (HELO HOMEOFFICE) (209.239.173.94) by smtp.inreach.com (qpsmtpd/0.28) with SMTP; Sun, 13 Mar 2005 18:46:39 -0800 Message-ID: <003101c5283e$6bb20780$6501a8c0@HOMEOFFICE> From: "Vincent Hikida" To: "Steven Verhoeven" , , References: <423190C1.5090406@dmbr.UGent.be> Subject: Re: sql question Date: Sun, 13 Mar 2005 18:34:59 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_002E_01C527FB.5C96D2F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.177 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_MESSAGE, HTML_TAG_EXIST_TBODY, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200503/572 X-Sequence-Number: 74887 This is a multi-part message in MIME format. ------=_NextPart_000_002E_01C527FB.5C96D2F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable SELECT t1.id , t1.fref FROM t1 UNION ALL SELECT t2.id , t2.mref FROM t2 ----- Original Message -----=20 From: Steven Verhoeven=20 To: pgsql-general@postgresql.org ; pgsql-novice@postgresql.org=20 Sent: Friday, March 11, 2005 4:36 AM Subject: [GENERAL] sql question Hi all=20 My table definition : id | fref | mref ------+-----------+---------- 1 | 23 | 25 2 | 24 | 28 3 | 25 | 31 4 | 26 | 34 My problem :=20 i need a query that results in this : id | ref ------+---------- 1 | 23 =20 1 | 25 2 | 24 2 | 28 3 | 25 =20 3 | 31 4 | 26 =20 4 | 34 Do I need a crosstab-query ? Who can help me ? --=20 A computer is like an airconditioner. When windows open, it stops = working ! =20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- = -- -- -- -- -- -- -- -- -- -- -- -- -- -- --=20 Steven Verhoeven, ICT Support Engineer=20 Department for Molecular Biomedical Research (DMBR) VIB - Ghent University 'Fiers-Schell-Van Montagu' building Technologiepark 927B - 9052 Ghent (Zwijnaarde) Belgium=20 Tel : +32-(0)9-33-13.606=20 Fax : +32-(0)9-33-13.609 E-mail : Steven.Verhoeven@dmbr.UGent.be = URL : http://www.dmbr.UGent.be=20 ------=_NextPart_000_002E_01C527FB.5C96D2F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
SELECT  t1.id
          &nbs= p;  =20 ,  t1.fref
    FROM t1
UNION ALL
SELECT t2.id
          &nbs= p;  =20 , t2.mref
    FROM = t2
 
----- Original Message -----
From:=20 Steven Verhoeven =
Sent: Friday, March 11, 2005 = 4:36=20 AM
Subject: [GENERAL] sql = question

Hi all

My table definition = :

   id=20 | fref      |=20 mref
------+-----------+----------
  1  =20 |     23    |   = 25
 =20 2   |     24    = |  =20 28
  3   |     = 25   =20 |   31
  4   |    =20 26    |   34


My problem :
i = need a=20 query that results in this :

   id = |   =20 ref
------+----------
  1   = |    =20 23  
  1   |     = 25
 =20 2   |     24
  2  =20 |     28
  3   = |    =20 25   
  3   = |    =20 31
  4   |     = 26   =20
  4   |     = 34



Do I=20 need a crosstab-query ?
Who can help me ?


------=_NextPart_000_002E_01C527FB.5C96D2F0--