grouping excluding some text results

From: "Fip" <Filippo(dot)Bernante(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: grouping excluding some text results
Date: 2006-10-26 07:25:58
Message-ID: 1161847558.199150.294690@i3g2000cwc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

ho can I select some one restult for type, excluding the rest?
I have something like, as result of a join:

| ID | score | description |
-----------------------------------------------------------------
MG01 56 "textual description1..."
MG02 47 "another text ..."
MG02 55 "textual description, text...." <----
note this
MG02 55 "textual description, text...." <----
note this
MG01 35 "this is a different text...."
MG02 61 "random chars..."
(...)

I know that is possible selecting by grouping if I use an aggregate
function:
> select ID,max(score) by table group by ID
but I want the description too, only one description, and I have a very
large dataset, I cannot cycle with more subselections, this require too
much time; also I want to exclude duplicates: only one ID.

What can I do?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart Grimshaw 2006-10-26 08:17:26 Re: Enableing contrib modules on Debian
Previous Message Chris 2006-10-26 06:20:25 Re: Reducing pg_dump & pg_restore times