pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Klint Gore <kg@kgb.une.edu.au>
To: Steven Verhoeven <Steven.Verhoeven@dmbr.UGent.be>
Cc: pgsql-general@postgresql.org
Cc: pgsql-novice@postgresql.org
Subject: Re: sql question
Date: Mon, 14 Mar 2005 13:44:51 +1100
Message-ID: <4234FAA316C.5233KG@129.180.47.120> (raw)
In-Reply-To: <423190C1.5090406@dmbr.UGent.be>
References: <423190C1.5090406@dmbr.UGent.be>

On Fri, 11 Mar 2005 13:36:17 +0100, Steven Verhoeven
<Steven.Verhoeven@dmbr.UGent.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@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             :                 :
+---------------------------------------+-----------------+



view thread (71+ messages)  latest in thread

Message-ID: <4234FAA316C.5233KG@129.180.47.120>
Permalink:  ../4234FAA316C.5233KG@129.180.47.120/
Also on:    postgresql.org/message-id/4234FAA316C.5233KG@129.180.47.120

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kg@kgb.une.edu.au, Steven.Verhoeven@dmbr.UGent.be, pgsql-novice@postgresql.org
  Subject: Re: sql question
  In-Reply-To: <4234FAA316C.5233KG@129.180.47.120>
  References: <423190C1.5090406@dmbr.UGent.be> <4234FAA316C.5233KG@129.180.47.120>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox