Article View: borland.public.vdbase.data.sql
Article #38Re: SQL OUTER JOIN giving unpredictable results
From: Romain Strieff [TeamB]
Date: Sat, 20 Feb 1999 00:00
Date: Sat, 20 Feb 1999 00:00
42 lines
1767 bytes
1767 bytes
In article <36CE28AB.704C343B@nospam.mcbsys.com>, Mark Berry politely
paraphrased ...
> After reading the posts here under the "Query troubles" topic, I'm
> wondering whether this whole thing may have to be re-written
> anyway--will I be able to delete the orphaned records if I ever get this
> JOIN to behave?
>
If the result is readonly you won't be able to delete them, behaveing or
not. I'm by no stretch of imagination an SQL guy, but this works for me,
try it out.
close all
erase master.dbf
erase child.dbf
if not file("MASTER.DBF")
create table "master.dbf" (order_id char(2))
use "master.dbf"
generate 10 //10 records from 01-10
replace all order_id with str(recno(),2,0,"0")
use
endif
if not file("CHILD.DBF")
create table "child.dbf" (order_id char(2))
use "child.dbf"
generate 7 //7 record from 01-07
replace all order_id with str(recno(),2,0,"0")
use
endif
DELETE FROM MASTER M WHERE NOT M.ORDER_ID IN;
(SELECT ORDER_ID FROM CHILD C WHERE c.ORDER_ID=M.ORDER_ID)
use master
//now 08.09 and 10 which where not in child.dbf
// are also deleted in the master
browse
--
Romain Strieff [TeamB]
Please read this newsgroup guide below before
posting on the private Inprise newsgroups.
http://www.inprise.com/newsgroups/guide.html
--
Technical Details
Message-ID:
<MPG.1138ae8f9e4467a8989e73@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36CE28AB.704C343B@nospam.mcbsys.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,3dc8d9196f7bc07d X-Google-Attributes: gidff5a1,public From: teamb@opto-pps.com (Romain Strieff [TeamB]) Subject: Re: SQL OUTER JOIN giving unpredictable results Date: 1999/02/20 Message-ID: <MPG.1138ae8f9e4467a8989e73@forums.inprise.com> X-Deja-AN: 446364808 References: <36CE28AB.704C343B@nospam.mcbsys.com> Organization: TeamB Newsgroups: borland.public.vdbase.data.sql