pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ben Kim <bkim@tamu.edu>
To: giuseppe.derossi@email.it
Cc: pgsql-admin@postgresql.org
Subject: Re: HELP, can't implement e filter
Date: Mon, 20 Aug 2007 09:07:46 -0500 (CDT)
Message-ID: <Pine.GSO.4.64.0708200905210.23093@coe.tamu.edu> (raw)
In-Reply-To: <5721d54f0ab9128f6c815295a036b0f4@83.225.9.51>
References: <5721d54f0ab9128f6c815295a036b0f4@83.225.9.51>

On Sun, 19 Aug 2007, giuseppe.derossi@email.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



view thread (5+ messages)  latest in thread

Message-ID: <Pine.GSO.4.64.0708200905210.23093@coe.tamu.edu>
Permalink:  ../Pine.GSO.4.64.0708200905210.23093@coe.tamu.edu/
Also on:    postgresql.org/message-id/Pine.GSO.4.64.0708200905210.23093@coe.tamu.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: bkim@tamu.edu, giuseppe.derossi@email.it
  Subject: Re: HELP, can't implement e filter
  In-Reply-To: <Pine.GSO.4.64.0708200905210.23093@coe.tamu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox