Re: find the greatest, pick it up and group by

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Ivan Sergio Borgonovo'" <mail(at)webthatworks(dot)it>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: find the greatest, pick it up and group by
Date: 2011-05-17 00:05:45
Message-ID: 001b01cc1426$2bae2e90$830a8bb0$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When asking for help on non-trivial SELECT queries it really helps to tell
us the version of PG you are using so that responders know what
functionality you can and cannot use. In this case specifically, whether
WINDOW (and maybe WITH) clauses available?

David J.

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Ivan Sergio Borgonovo
> Sent: Monday, May 16, 2011 7:39 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] find the greatest, pick it up and group by
>
>
> I'd like to group by idordine, grupposped, idart.
> For every row grouped that way, I'd like to pick the greatest of the
> q* columns and insert:
> idordine, grupposped, idart, name of the greatest(q*) in a new table.
> I don't mind if more than one q* column is equal to greatest(q*). It
should
> pick up one, just one no matter which among the one equal to greatest(q*).
>
> I think this way works but it hurts my eyes. Any alternative approach?
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2011-05-17 00:26:50 Re: find the greatest, pick it up and group by
Previous Message Ivan Sergio Borgonovo 2011-05-16 23:53:19 Re: COPY complaining about unquoted carriage return found in data... in a quoted field