Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: HELP, can't implement e filter



On Sun, 19 Aug 2007, giuseppe(dot)derossi(at)email(dot)it 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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group