Subject | Re: Are these statements equivalent |
---|---|
Author | bojo_alex <bojo_alex@yahoo.com> |
Post date | 2003-02-10T07:41:57Z |
--- In ib-support@yahoogroups.com, "Leyne, Sean" <sleyne@a...> wrote:
the
outer query the more exact equivalent is:
select avg(updates.col_decim)
from updates
join hundred ON (hundred.col_key = updates.col_key) and
(updates.col_decim >
980000000)
--
Bojidar Alexanrov
Kodar Ltd.
http://www.Kodar.net
> All,poorly
>
> I am reviewing a program which was originally created 10+ years ago.
> Some SQL statements which are executed are performing extremely
> and I am trying to optimize them.restating
>
> Accordingly, I'd like some "2nd opinions" about the way I am
> the statements.database
>
> The original statement reads:
>
> select avg(updates.col_decim)
> from updates
> where
> updates.col_key in
> (select updates.col_key
> from updates, hundred
> where hundred.col_key = updates.col_key
> and updates.col_decim > 980000000)
>
> My new statement reads:
>
> select avg(updates.col_decim)
> from updates
> join hundred ON hundred.col_key = updates.col_key
> where updates.col_decim > 980000000
>
>
> I can tell you that they both provide the same answer, for the
> I'm working with.For this query - yes. But if you have more conditions in the where of
>
> Does anyone think that the two statements ARE NOT equivalent?
>
>
> Sean
the
outer query the more exact equivalent is:
select avg(updates.col_decim)
from updates
join hundred ON (hundred.col_key = updates.col_key) and
(updates.col_decim >
980000000)
--
Bojidar Alexanrov
Kodar Ltd.
http://www.Kodar.net