Subject | Re: problem with multicolumn subselect |
---|---|
Author | fabiano_bonin |
Post date | 2005-07-26T18:47:07Z |
--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<mpn2001@y...> wrote:
select
min(col1)
from
table1
where
exists ( select * from table2 where col4 = table1.col2 and col5 =
table1.col3 and col6 = variable )
This way FB will make use of indices if available, and your query will
be much faster.
Regards,
Fabiano.
<mpn2001@y...> wrote:
> Hello Jeremy,Or, preferably:
>
> WJ> Select min (col1)
> WJ> From table1
> WJ> Where (col2, col3) in
> WJ> (select col4, col5 from table2 where col6 = variable);
>
> I guess in FB it should be
>
> Select min (col1)
> From table1
> Where col2 in
> (select col4 from table2 where col6 = variable) and
> col3 in
> (select col5 from table2 where col6 = variable);
>
select
min(col1)
from
table1
where
exists ( select * from table2 where col4 = table1.col2 and col5 =
table1.col3 and col6 = variable )
This way FB will make use of indices if available, and your query will
be much faster.
Regards,
Fabiano.