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 ... 5 5 5 ... should leave a b c other fields ===== 3 2 3 .... 4 2 2 ... 5 5 5 ... is there some clever command for this or will I have to write a special function that loops through all values of b and c ? -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general