Article View: borland.public.interbase.sql
Article #828Re: DELETEing orphaned records
From: esnpe
Date: Tue, 15 May 2007 10:07
Date: Tue, 15 May 2007 10:07
33 lines
1668 bytes
1668 bytes
Mainy thanks Danny. I'm new to interbase/firebird (actually using the latter) and know only basic SQL at the moment. Now I know why I couldn't find the correct syntax. The task records should've been deleted when the server records were deleted. This is a one-off and I saw examples of delete using a join in other SQL databases. cheers Paul Van den Wouwer Danny <danny.van.den.wouwer@pandora.be> wrote in news:4646d064$1@newsgroups.borland.com: > Hi Paul, > > You can't use joins in a delete: > > I have 2 solutions in mind: > > 1) DELETE > FROM "Tasks" T > WHERE NOT EXISTS ( > SELECT * > FROM "Servers" S > WHERE S."ClientName" = T."ClientName" > AND S."ServerName" = T."ServerName") > > --> This isn't the fasted way to go, because the table "Tasks" will be > scanned naturally. > > 2) Write a small stored procedure >
Technical Details
Message-ID:
<Xns9931714AB38D3esnpehotmailcouk@207.105.83.66>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4646cba7@newsgroups.borland.com> <4646d064$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,917a31690354dae3 X-Google-Attributes: gid114a0e,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: borland.public.interbase.sql Subject: Re: DELETEing orphaned records From: esnpe <esnpe@hotmail.co.uk> References: <4646cba7@newsgroups.borland.com> <4646d064$1@newsgroups.borland.com> Message-ID: <Xns9931714AB38D3esnpehotmailcouk@207.105.83.66> User-Agent: Xnews/5.04.25 NNTP-Posting-Host: 217.155.206.177 Date: 15 May 2007 03:07:20 -0700 X-Trace: newsgroups.borland.com 1179223640 217.155.206.177 (15 May 2007 03:07:20 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail