sql question

Started by Steven Verhoevenabout 21 years ago3 messagesgeneral
Jump to latest
#1Steven Verhoeven
Steven2@dmbr.ugent.be

My table definition :

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

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 ?

#2George Essig
george.essig@gmail.com
In reply to: Steven Verhoeven (#1)
Re: sql question

On Fri, 11 Mar 2005 13:26:07 +0100, Steven Verhoeven
<Steven2@dmbr.ugent.be> wrote:

My table definition :

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

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 ?

select id, fref as ref from my_table
union
select id, mref as ref from my_table;

#3Ragnar Hafstað
gnari@simnet.is
In reply to: George Essig (#2)
Re: sql question

On Sun, 2005-03-13 at 23:13 -0600, George Essig wrote:

On Fri, 11 Mar 2005 13:26:07 +0100, Steven Verhoeven
<Steven2@dmbr.ugent.be> wrote:

[snip problem]

select id, fref as ref from my_table
union
select id, mref as ref from my_table;

union ALL

(see other replies)

gnari