From: | Andreas Kretschmer <andreas(at)a-kretschmer(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> |
Subject: | Re: Help with a select statement design |
Date: | 2012-12-28 15:42:59 |
Message-ID: | 827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> hat am 24. Dezember 2012 um 17:30
geschrieben:
> I have a record with the following fields:
>
> id1, id2, id3, id4, price1, price2, price3, price4
>
> I would like to write a SELECT statement in order to get 4 records:
>
> id, price (record that comes from id1 and price 1)
> id, price (record that comes from id2 and price 2)
> id, price (record that comes from id3 and price 3)
> id, price (record that comes from id4 and price 4)
>
> I will very much appreciate any suggestion.
>
> Respectfully,
> Jorge Maldonado
select id1 as id, price1 as price
union all
select id2, price2
union all
select id3, ... you got it?
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Franz Timmer | 2012-12-28 16:12:05 | Re: Help with a select statement design |
Previous Message | Andreas Kretschmer | 2012-12-28 15:30:37 | Re: sql basic question |