Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: DBA FIGHT

Re: DBA FIGHT

From: denaro <denaro_at_freemail.it>
Date: Tue, 24 Jun 2003 15:17:26 +0200
Message-ID: <bd9j75$315$1@lacerta.tiscalinet.it>


I am sorry but the hot make me crazy.

the right samples are:

select *
from table1 t1
where t1.a in
 (
select t2.a
from fable2 t2
where t1.b = t1.b
);

select *
from table1 t1, table2 t2
where t1.a in t2.a
and t1.b = t1.b

"andrewst" <member14183_at_dbforums.com> ha scritto nel messaggio news:3036987.1056453423_at_dbforums.com...
>
> Originally posted by Denaro
> > These queries are equivalents?
> > Same results?
> > Same performance?
> >
> > select *
> > from table1 t1
> > where t1.a in
> > (
> > select t2.a
> > from fable2 t2
> > where t1.b = t1.a
> > )
> >
> >
> > select *
> > from table1 t1
> > table2 t2
> > where t1.a in t2.a
> > and t1.b = t1.a
> They are equivalent in that both are invalid queries, and neither makes
> much sense. Presumably "fable1" should be "table1" in the first query,
> and you are missing a comma in the second.
>
> Correct those errors and they give different results:
>
> SQL> select *
> 2 from table1 t1
> 3 where t1.a in
> 4 (
> 5 select t2.a
> 6 from fable2 t2
> 7 where t1.b = t1.a
> 8 );
>
> A B
> ---------- ----------
> 2 2
> 4 4
> 6 6
> 8 8
> 10 10
>
> SQL> select *
> 2 from table1 t1
> 3 table2 t2
> 4 where t1.a in t2.a
> 5 and t1.b = t1.a;
>
> A B A
> ---------- ---------- ----------
> 2 2 2
> 2 2 2
> 4 4 4
> 4 4 4
> 6 6 6
> 6 6 6
> 8 8 8
> 8 8 8
> 10 10 10
> 10 10 10
>
> I suggest you get the queries correct and doing the same thing before
> you try to measure performance.
>
> --
> Posted via http://dbforums.com
Received on Tue Jun 24 2003 - 08:17:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US