Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9B7D163354B for ; Wed, 19 Aug 2009 07:17:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42696-09 for ; Wed, 19 Aug 2009 10:17:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f186.google.com (mail-iw0-f186.google.com [209.85.223.186]) by mail.postgresql.org (Postfix) with ESMTP id D1A1A632A65 for ; Wed, 19 Aug 2009 07:17:09 -0300 (ADT) Received: by iwn16 with SMTP id 16so115995iwn.15 for ; Wed, 19 Aug 2009 03:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=IKMBV6nVjr2bTPiOrF34Kzm5NTFQTUBG9gWfFLC0Vo8=; b=c7NqeDIUWkmUha5PAeZSY9RDGh1cxI8RfQTeiZKaUvT2Zitvqk6tlttGdVS36KTmbp 7ewadaupEUAHhF/x65IJF7oz5eIQ+alUicXe8ZeYno5RW4HYDdYt0rpQ134qqwKQuFSR lVZiBEp/QeQLNJjwxoz1dAZAirfPrzxQ7Xits= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=waC906pBo9klMvxf6oteCzc+NSv7ZDOd5im/GapjcTwdWGLl8oPKlpYQZLOOG/ryHc RSb/F4zAG/2QyyzSQWUJh3tOGiVXpbEcuBrcFCsgPMAlCt4kv3gk646o3mt55KFoJukO BPxVZplgg1ctv1vgGobkjLmg+7ibQWPMcLg9s= MIME-Version: 1.0 Received: by 10.231.37.204 with SMTP id y12mr3744075ibd.6.1250677027205; Wed, 19 Aug 2009 03:17:07 -0700 (PDT) Date: Wed, 19 Aug 2009 17:17:07 +0700 Message-ID: <1703cd180908190317p3b1c4140hc9cbe41331c0725e@mail.gmail.com> Subject: Ask About SQL From: Otniel Michael To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=00032557679eef74dc04717bef03 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.184 tagged_above=-10 required=5 tests=BAYES_40=-0.185, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200908/101 X-Sequence-Number: 33010 --00032557679eef74dc04717bef03 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi All. Can help to create sql queries for this data : tabel A field1, field2, field3 x1, y1, 5 x1, y2, 1 x2, y1, 2 x2, y3, 4 x1, y3, 4 I want to get 2 record with the max value at field3 for each kombination of field1 : tabel B field1, field2, field3 x1, y1, 5 x1, y3, 4 x2, y3, 4 x2, y1, 2 Anyone have an ideas? Thanks anyway. -- ------------------------------------------------------------------- "He who is quick to become angry will commit folly, and a crafty man is hated" --00032557679eef74dc04717bef03 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi All.

Can help to create sql queries for this data :

tabel A
field1, field2, field3
x1,=A0=A0=A0=A0 y1,=A0=A0=A0=A0 5
x1,=A0=A0=A0=A0 y2,=A0=A0=A0=A0 1
x2,=A0=A0=A0=A0 y1,=A0=A0=A0= =A0 2
x2,=A0=A0=A0=A0 y3,=A0=A0=A0=A0 4
x1,=A0=A0=A0=A0 y3,=A0=A0=A0=A0 4

I want to get 2 record with the ma= x value at field3 for each kombination of field1 :

tabel B
field1, field2, field3
x1,=A0=A0=A0=A0 y1,=A0=A0=A0=A0 5
x1,=A0=A0=A0=A0 y3,=A0=A0=A0=A0 4

x2,=A0=A0=A0=A0 y3,=A0=A0=A0=A0 4

x2,=A0=A0=A0=A0 y1,=A0=A0=A0=A0 2


Anyone have an ideas?
T= hanks anyway.

--
--------------------------= -----------------------------------------
"He who is quick to become angry will commit folly, and a crafty man i= s hated"
--00032557679eef74dc04717bef03--