Re: sql group by statement

From: "Albrecht Berger" <berger1517(at)gmx(dot)ch>
To: "pgsql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sql group by statement
Date: 2002-09-13 10:39:46
Message-ID: 006501c25b11$e30914b0$a07ba8c0@wxp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

but how do I know that "distinct on" doesn't cut off
the row with max(val2) of that id that I need ?

> see the yesterday's thread about DISTINCT ON (non-standard Postgres
feature)
>
> > I have a problem, which I'm not able to solve with a simple query :
> >
> > I need a resultset with distinct id's, but the max val2 of each id.
> > I tried to group by id, but though I need the pk in my resultset
> > I have to group it too, which "destroys" the group of val2.
>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Paesold 2002-09-13 10:43:10 Assignments in PL/pgSQL
Previous Message dima 2002-09-13 10:33:59 Re: sql group by statement