Select and merge rows?

From: Claudio Adriano Guarracino <elninon(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Select and merge rows?
Date: 2011-05-05 20:53:02
Message-ID: 607516.4301.qm@web161318.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Excuse me,
The original table is:
order    ID    value   
----------------------
1    1000    3
2    1000    5
3    1000    6
1    1001    1
2    1001    2
1    1002    4
2    1002    4

The result of table should be:
id            value1    value2    value3
----------------------------------------------------
1000        3           5           6
1001        1           2
1002        4           4

Thanks!
Regards,

--- On Thu, 5/5/11, Claudio Adriano Guarracino <elninon(at)yahoo(dot)com> wrote:

From: Claudio Adriano Guarracino <elninon(at)yahoo(dot)com>
Subject: Select and merge rows?
To: pgsql-sql(at)postgresql(dot)org
Date: Thursday, May 5, 2011, 4:18 PM

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,

Browse pgsql-sql by date

  From Date Subject
Next Message Charlie 2011-05-05 21:41:04 Re: [SQL] Select and merge rows?
Previous Message Oliveiros 2011-05-05 20:24:54 Re: Select and merge rows?