Re: simple SQL query problem
From: Reinhard Kuhn <rek_at_cas-ps.com>
Date: 1995/09/21
Message-ID: <43rgeu$mad_at_fred.cas-ps.com>#1/1
Date: 1995/09/21
Message-ID: <43rgeu$mad_at_fred.cas-ps.com>#1/1
In article <43praf$t6j_at_homer.alpha.net>, sahmad_at_mfa.com says...
>
>Maria SKIADELLI (Maria.SKIADELLI_at_cern.ch) wrote:
>> Hello there,
>> is there anybody that knows how can I select using an SQL statement
>> only one member-record of a set that matches a certrain condition,
>> (no matter which one)?
>
>if i understand correctly, something like:
>
>select ....
>from the_table a
>where
> a.rowid = ( select max(b.rowid)
> from the_table b
> where b.aaaa = a.aaaa
> );
>
>[...]
Or (for better performance) something like
select ....
from the_table a
where not exists
( select null from the_table b where ( b.aaaa = a.aaaa ) and ( b.rowid > a.rowid ) );
Hope this helps
-- _/_/_/ _/_/_/ _/ _/ // Reinhard Kuhn / It can be _/ _/ _/ _/ _/ // (kuhn_at_cas-ps.com) / done quickly, _/_/_/ _/_/_/ _/_/ // CAS GmbH / cheaply or well _/ _/ _/ _/ _/ // Lemberger Strasse 14 / - pick any two! _/ _/ _/_/_/ _/ _/ // 66955 Pirmasens, Germany /Received on Thu Sep 21 1995 - 00:00:00 CEST