Subject Re: [firebird-support] Select how to
Author Lucas Franzen
sboydlns schrieb:


> Suppose I have:
>
> table1 (table1_key varchar);
> table2 (table2_key varchar;
> table2_sequence_number integer;
> somefield : varchar);
>
> Is it possible to structure a SELECT statement that will retrieve all
> records from table1 such that COUNT(table2_sequence) WHERE table2_key
> = table1_key AND somefield = 'some value' is at most some arbirtrary
> value.
>
> I don't want to do a SELECT ... FROM table1 where table1_key IN (...)

Have you considered replacing the

SELECT ... FROM table1 where table1_key IN (...)

with

SELECT ... FROM table1 where EXISTS (...)


I don't know a faster way than that.

Luc.