pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliveiros <oliveiros.cristina@gmail.com>
To: Claudio Adriano Guarracino <elninon@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Select and merge rows?
Date: Thu, 5 May 2011 21:24:54 +0100
Message-ID: <BANLkTinDJXcVTJb5gCJtws+ma-M36EcjoA@mail.gmail.com> (raw)
In-Reply-To: <139192.67117.qm@web161316.mail.bf1.yahoo.com>
References: <139192.67117.qm@web161316.mail.bf1.yahoo.com>

Howdy!

Is there a maximum ceilling of three values per order ID? or an ID can have
an arbitrary number of values?

Best,
Oliveiros

2011/5/5 Claudio Adriano Guarracino <elninon@yahoo.com>

> Hello!
> I have a doubt about a query that I tried to do, but I cant......
> This is the scenario:
> I have a table, with this rows:
> order    ID    value
> ----------------------
> 1    1000    3
> 2    1000    5
> 3    1000    6
> 1    1001    1
> 2    1001    2
> 1    1002    4
> 2    1002    4
>
> I need to get this table, divided by ID, like this:
> id    value1    value2    value3
> --------------------------------
> 1000    3    5    6
> 1001    1    2
> 1002    1    2
>
> How I can do this?
> I tried with cursors and view, but i can't....
> Any help is welcome!
>
> Thanks in advance!
> Regards,
>
>

view thread (6+ messages)  latest in thread

Message-ID: <BANLkTinDJXcVTJb5gCJtws+ma-M36EcjoA@mail.gmail.com>
Permalink:  ../BANLkTinDJXcVTJb5gCJtws+ma-M36EcjoA@mail.gmail.com/
Also on:    postgresql.org/message-id/BANLkTinDJXcVTJb5gCJtws+ma-M36EcjoA@mail.gmail.com

 · 

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: oliveiros.cristina@gmail.com, elninon@yahoo.com
  Subject: Re: Select and merge rows?
  In-Reply-To: <BANLkTinDJXcVTJb5gCJtws+ma-M36EcjoA@mail.gmail.com>

* 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