Re: Delete query
From: Uri Dimant (urid_at_iscar.co.il)
Date: 03/09/04
- Next message: Uri Dimant: "Re: Alter table alter column"
- Previous message: Christian Kuendig: "merging of development and production db"
- In reply to: simon: "Delete query"
- Next in thread: Karl Gram: "Re: Delete query"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 9 Mar 2004 12:34:04 +0200
simon
If you are concered about performance and you have a large set of data ,so
you can consider using WHERE NOT EXISTS /EXISTS clause for such subqueries.
"simon" <simon.zupan@stud-moderna.si> wrote in message
news:#RRhKEcBEHA.3400@tk2msftngp13.phx.gbl...
> I have 2 tables with columns: ID,countryID and date.
>
> I would like to delete all rows in table T1 which id and country id exists
> also in table T2 after specific date.
>
> This works (I think) but is there any other query with better perforamnce,
> some kind of join?
>
> DELETE * FROM T1 WHERE T1.ID IN (SELECT ID FROM T2 WHERE date>@date)
> AND T1.countryID IN (SELECT country ID FROM T2 WHERE date>@date)
>
> Thank you,
> Simon
>
>
- Next message: Uri Dimant: "Re: Alter table alter column"
- Previous message: Christian Kuendig: "merging of development and production db"
- In reply to: simon: "Delete query"
- Next in thread: Karl Gram: "Re: Delete query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|