--- Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Joe Wilson <developir-/[EMAIL PROTECTED]> wrote:
> > delete from table1 where rowid in (
> >  select table1.rowid
> >    from table2
> >   where table1.id = table2.id
> >     and table2.otherid = 1
> > );
> 
> Why not just
> 
>  delete from table1 where id in (
>   select id from table2
>    where table2.otherid = 1
>  );

Yep, I missed that.

But in the (admittedly unlikely) event that table1 was small 
and table2 had billions of rows and otherid had low cardinality
or otherid was not indexed, while id was indexed in both tables,
then the first form could be more efficient.   ;-)




      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to