Re: query question - Mailing list pgsql-novice

From Tom Lane
Subject Re: query question
Date
Msg-id 23206.1316617878@sss.pgh.pa.us
Whole thread Raw
In response to query question  (pg noob <pgnube@gmail.com>)
List pgsql-novice
pg noob <pgnube@gmail.com> writes:
> Is there an efficient way to select the set of rows which have the max
> values across multiple columns?

I think SELECT DISTINCT ON might help you.  The idea is to sort the rows
in an appropriate order then take the first row from each group.  Look
at the "weather reports" example in PG's SELECT reference page for
inspiration.

            regards, tom lane

pgsql-novice by date:

Previous
From: Asli Akarsakarya
Date:
Subject: a spatial table's bounding box
Next
From: e-letter
Date:
Subject: ERROR: invalid input syntax for integer: