Subject | Re: Query slow |
---|---|
Author | sivram_mail |
Post date | 2003-04-16T14:52:22Z |
As Daniel said,
i can use the Exists also.But my dba is telling that don't use
subqueries.
Can i get the desired output without subquery???
Sivaraman
--- In ib-support@yahoogroups.com, "Martijn Tonies" <m.tonies@u...>
wrote:
i can use the Exists also.But my dba is telling that don't use
subqueries.
Can i get the desired output without subquery???
Sivaraman
--- In ib-support@yahoogroups.com, "Martijn Tonies" <m.tonies@u...>
wrote:
> Ah, that question. Did you try the suggestions of the others who
> responded?
>
> --
> Martijn
>
>
> > Hi Martijn,
> >
> > sorry for reposting..
> >
> >
> > this is my query:
> > -----------------
> >
> > Hello,
> > i have two tables .
> >
> > table 1
> >
> > id name no
> >
> > table 2
> >
> > id no
> >
> > table 2's id field is referenced to table 1's id field .
> >
> >
> > now i want to retrieve the records from table 1 and no not in
> > table 2.
> >
> > this is the query which is written:
> > -----------------------------------
> > select * from table1 where id not in
> > (select id from table2,table1 where table1.no=table2.no )
> >
> > In this query , there is no join condition for primary key.
> >
> >
> > If i rearrange this query to
> >
> > select * from table1 a where
> > a.id not in (select id from
> > table2 b where a.id=b.id and a.no=b.no)
> >
> >
> > Will it work fine????
> > And my dba is telling that don't use "ot in".
> > without "not in" how can i write this query??