Subject | RE: [firebird-support] Re: problem with multicolumn subselect |
---|---|
Author | Wilson, Jeremy |
Post date | 2005-07-26T18:49:30Z |
Thanks,
________________________________________
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of fabiano_bonin
Sent: Tuesday, July 26, 2005 2:47 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: problem with multicolumn subselect
--- 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.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical support
Computer security
Computer technical support
Computer training
Free computer technical support
________________________________________
YAHOO! GROUPS LINKS
* Visit your group "firebird-support" on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
________________________________________
________________________________________
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of fabiano_bonin
Sent: Tuesday, July 26, 2005 2:47 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: problem with multicolumn subselect
--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<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.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical support
Computer security
Computer technical support
Computer training
Free computer technical support
________________________________________
YAHOO! GROUPS LINKS
* Visit your group "firebird-support" on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
________________________________________