Re: sql question

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: Steven Verhoeven <Steven(dot)Verhoeven(at)dmbr(dot)UGent(dot)be>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: sql question
Date: 2005-03-14 02:44:51
Message-ID: 4234FAA316C.5233KG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

On Fri, 11 Mar 2005 13:36:17 +0100, Steven Verhoeven
<Steven(dot)Verhoeven(at)dmbr(dot)UGent(dot)be> 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(at)kgb(dot)une(dot)edu(dot)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 : :
+---------------------------------------+-----------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-03-14 02:52:19 Re: [PATCHES] A way to let Vacuum warn if FSM settings are low. [final?]
Previous Message Vincent Hikida 2005-03-14 02:42:43 Re: [NOVICE] sql question

Browse pgsql-novice by date

  From Date Subject
Next Message David Gagnon 2005-03-14 14:13:27 Re: preoblem in jdbc postgresql and tomcat
Previous Message Vincent Hikida 2005-03-14 02:42:43 Re: [NOVICE] sql question