Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 40E071337BEF for ; Thu, 5 May 2011 17:25:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 82550-03 for ; Thu, 5 May 2011 20:24:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) by mail.postgresql.org (Postfix) with ESMTP id ACBB51337BF7 for ; Thu, 5 May 2011 17:24:54 -0300 (ADT) Received: by qwk3 with SMTP id 3so1759342qwk.19 for ; Thu, 05 May 2011 13:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Uis5dfk9uMKYFLaWFR3me4LyT0EAeuc6KDIfCWXXkN0=; b=MmGTYZKyks0gBchJPCVbikamzqFZ2MA5LbtTEdUaN9ELbl2739cN43RZt6a1b8VvV5 uVELPy/IttDs30/qffEId45sbwX0bUaM+IhZ4nJg3SK6309DPsvofTTLG9C5wyNLVVuo BBdUTeO74PK2OqfHClbr8SrBGUGEmi+OtlZ/U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=tTgU4/Xa1yYbMQ64SFpf3UTus2PBwI8E97YCULVNj0/g7eiM3wY3Hz6I07BFl9fccf c5GF/s4SwYMhb+lV0F1DtPM+OIUh2pjtPwFDuPRGN5uk/pnzjKWEwRU6mV2VAFwfA0Rw v8P/gby2/IkHyliXVBmK6dF+zGFTWJ1J2+baA= MIME-Version: 1.0 Received: by 10.229.87.143 with SMTP id w15mr1952806qcl.170.1304627094527; Thu, 05 May 2011 13:24:54 -0700 (PDT) Received: by 10.229.44.82 with HTTP; Thu, 5 May 2011 13:24:54 -0700 (PDT) In-Reply-To: <139192.67117.qm@web161316.mail.bf1.yahoo.com> References: <139192.67117.qm@web161316.mail.bf1.yahoo.com> Date: Thu, 5 May 2011 21:24:54 +0100 Message-ID: Subject: Re: Select and merge rows? From: Oliveiros To: Claudio Adriano Guarracino Cc: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=0016364ef192889f5a04a28d2a6a X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.897 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/24 X-Sequence-Number: 35308 --0016364ef192889f5a04a28d2a6a Content-Type: text/plain; charset=ISO-8859-1 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 > 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, > > --0016364ef192889f5a04a28d2a6a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=A0=A0= =A0 ID=A0=A0=A0 value=A0=A0=A0
----------------------
1=A0=A0=A0 100= 0=A0=A0=A0 3
2=A0=A0=A0 1000=A0=A0=A0 5
3=A0=A0=A0 1000=A0=A0=A0 6
1=A0=A0=A0 1001=A0=A0=A0 1
2=A0=A0=A0 1001= =A0=A0=A0 2
1=A0=A0=A0 1002=A0=A0=A0 4
2=A0=A0=A0 1002=A0=A0=A0 4
=
I need to get this table, divided by ID, like this:
id=A0=A0=A0 valu= e1=A0=A0=A0 value2=A0=A0=A0 value3
--------------------------------
1000=A0=A0=A0 3=A0=A0=A0 5=A0=A0=A0 6
1001=A0=A0=A0 1=A0=A0=A0 2
1002=A0=A0=A0 1=A0=A0=A0 2

How I can do this?
I tried with = cursors and view, but i can't....
Any help is welcome!

Thanks= in advance!
Regards,


--0016364ef192889f5a04a28d2a6a--