pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <andreas@a-kretschmer.de>
To: pgsql-sql@postgresql.org, JORGE MALDONADO <jorgemal1960@gmail.com>
Subject: Re: Help with a select statement design
Date: Fri, 28 Dec 2012 16:42:59 +0100 (CET)
Message-ID: <827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de> (raw)
In-Reply-To: <CAAY=A79K_75c3EhK2U7PSK1zZBRJkUwfPDRU=s0z-t46mUuOYQ@mail.gmail.com>
References: <CAAY=A79K_75c3EhK2U7PSK1zZBRJkUwfPDRU=s0z-t46mUuOYQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>



JORGE MALDONADO <jorgemal1960@gmail.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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (3+ messages)  latest in thread

Message-ID: <827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de>
Permalink:  ../827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de/
Also on:    postgresql.org/message-id/827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas@a-kretschmer.de, jorgemal1960@gmail.com
  Subject: Re: Help with a select statement design
  In-Reply-To: <827851602.423235.1356709379875.JavaMail.open-xchange@ox.ims-firmen.de>

* 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