Re: [GENERAL] How to delete rows number 2,3,4...

2010-10-09 Thread Ben Carbery
Depending on the significance of the primary key, another option may have been simply a unique constraint (b,c) on the table before the data was added On Fri, Oct 8, 2010 at 9:55 PM, A B wrote: > Thank you all for your replies. > > > 2010/10/8 Alban Hertroys : > > On 8 Oct 2010, at 8:59, A B wro

Re: [GENERAL] How to delete rows number 2,3,4...

2010-10-08 Thread A B
Thank you all for your replies. 2010/10/8 Alban Hertroys : > On 8 Oct 2010, at 8:59, A B wrote: > >> Hello. >> >> I have a table >> >> create table foo ( >> a serial, >> b int, >> c int, >> more fields ...); >> >> and now I wish to remove for each combination of b and c,  all the >> rows exc

Re: [GENERAL] How to delete rows number 2,3,4...

2010-10-08 Thread Alban Hertroys
On 8 Oct 2010, at 8:59, A B wrote: > Hello. > > I have a table > > create table foo ( > a serial, > b int, > c int, > more fields ...); > > and now I wish to remove for each combination of b and c, all the > rows except the one with the highest value of a. Or said differently: Delete all

[GENERAL] How to delete rows number 2,3,4...

2010-10-08 Thread A B
Hello. I have a table create table foo ( a serial, b int, c int, more fields ...); and now I wish to remove for each combination of b and c, all the rows except the one with the highest value of a. For example a b c other fields = 1 5 5 . 2 5 5 3 2 3 4 2 2 .