On Sun, 19 Aug 2007, [EMAIL PROTECTED] wrote:

Hi,
I need to implement a filter in order to select from the first table the
second one...
 c1     c2 c3     c4     c5
1)133659;1;"0039";"00121";7
2)133664;1;"0039";"00121";12
3)133664;2;"0039";"00121";12
4)133665;2;"0039";"00121";12
5)135460;1;"0039";"01152";
6)135460;2;"0039";"01152";
7)135471;1;"0050";"00153";4
8)135471;2;"0050";"00153";4

1)133659;1;"0039";"00121";7
3)133664;2;"0039";"00121";12
4)133665;2;"0039";"00121";12
6)135460;2;"0039";"01152";
8)135471;2;"0050";"00153";4

There should be something better but this might work.

select * from testtable where (c1,c2) in (select c1, max(c2) from testtable group by c1 );


HTH

Ben K.
Developer
http://benix.tamu.edu

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to