[Babase] removing records from samples and associated tables

Karl O. Pinc babase@www.eco.princeton.edu
Fri, 28 Oct 2005 20:34:38 +0000


On 10/28/2005 02:34:47 PM, Leah Gerber wrote:
> Karl,
> 
> I am wondering if there is an easy way to remove all the records  
> associated with one sname in SAMPLES. There are 163 rows in samples  
> that have DAS (a male) as an sname. Is there a way to remove the  
> associated rows from JPSAMPS, FPSAMPS, ADLIBS, PARTS, and INTERACT in  
> a more automated fashion? I can do it by hand but it will take quite  
> a while.

Well yes, but I think it would involve writing a program.  Which
would probably take longer than doing it by hand.  You can look
up the foxpro DELETE command and see if it will let you add a WHERE
clause to write something like:

DELETE FROM JPSAMPS WHERE SAMPLES.SNAME = 'DAS' AND
   JPSAMPS.SID = SAMPLES.SID

but as I recall foxpro won't do that.

Try also:

DELETE FROM JPSAMPS WHERE SID IN (SELECT SAMPLES.SID
   FROM SAMPLES WHERE SNAME = 'DAS')


(Be careful not to delete SAMPLES before JPSAMPs, etc.)

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein