Re: sql question

From: Chris Travers <chris(at)travelamericas(dot)com>
To: Steven Verhoeven <Steven(dot)Verhoeven(at)dmbr(dot)UGent(dot)be>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: sql question
Date: 2005-03-14 17:50:09
Message-ID: 4235CED1.6070309@travelamericas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

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 ?
> Who can help me ?

How about
select id, mref AS ref from table
UNION
select id, fref AS ref from table

Or is that not what you want?

Best Wishes,
Chris Travers
Metatron Technology Consulting

>
>
> --
> /A computer is like an airconditioner. When windows open, it stops
> working ! /
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
> Steven Verhoeven, ICT Support Engineer
>
>
> Department for Molecular Biomedical Research (DMBR)
> VIB - Ghent University 'Fiers-Schell-Van Montagu' building
> Technologiepark 927B - 9052 Ghent (Zwijnaarde)
> Belgium
> Tel : +32-(0)9-33-13.606
> Fax : +32-(0)9-33-13.609 E-mail : Steven(dot)Verhoeven(at)dmbr(dot)UGent(dot)be
> URL : http://www.dmbr.UGent.be
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-03-14 17:53:07 Re: Peculiar performance observation....
Previous Message Jeff Amiel 2005-03-14 17:46:44 Re: skip weekends: revisited

Browse pgsql-novice by date

  From Date Subject
Next Message Christian Hofmann 2005-03-14 20:41:11 Problem: Joining each column of a "one row query" with the result of a "many row query"
Previous Message Michael Fuhr 2005-03-14 16:06:52 Re: set-returning function in pg 7.4.6