Re: [SQL] sql group by statement

2002-09-13 Thread Manfred Koizar
On Fri, 13 Sep 2002 12:29:21 +0200, "Albrecht Berger" <[EMAIL PROTECTED]> wrote: >Table : >pk id val1 val2 > 112 3 > 212 4 > 321 1 > 410 5 > 521 8 > > >Needed Result : >pk id val1 val2 > 410 5 > 521 8 Albrecht, "DISTI

Re: [SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
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 i

Re: [SQL] sql group by statement

2002-09-13 Thread dima
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 t

[SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
Hello, 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. Can this be done without a h