| From: | Russell Smith <mr-russ(at)pws(dot)com(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:39:20 |
| Message-ID: | 200503141339.21286.mr-russ@pws.com.au |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-novice |
On Fri, 11 Mar 2005 11:36 pm, 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
>
SELECT id, fref as ref FROM table
UNION ALL
SELECT id, mref as ref FROM table;
Should do the trick.
>
> Do I need a crosstab-query ?
> Who can help me ?
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vincent Hikida | 2005-03-14 02:42:43 | Re: [NOVICE] sql question |
| Previous Message | Vincent Hikida | 2005-03-14 02:34:59 | Re: sql question |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vincent Hikida | 2005-03-14 02:42:43 | Re: [NOVICE] sql question |
| Previous Message | Vincent Hikida | 2005-03-14 02:34:59 | Re: sql question |