BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to delete so good?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Bpk. Adi Wira Kusuma
Guest





PostPosted: Thu Jul 21, 2005 6:10 pm    Post subject: How to delete so good? Reply with quote



I ask to you. How to delete data at table A that exist at table B.
Usually I write like this:

DELETE FROM TA where NOID in (SELECT NOID FROM TB).

But it can works, if at table A (TA) has 1 field to be primary key. If table
A (TA) has 4 fields to be primary key. How its syntax so good?


Back to top
Bill Todd
Guest





PostPosted: Thu Jul 21, 2005 6:39 pm    Post subject: Re: How to delete so good? Reply with quote



DELETE FROM TA
where EXISTS (SELECT SELECT 1 FROM TB
WHERE TA.PK1 = TB.PK1 AND TA.PK2 = TB.PK2)

--
Bill Todd (TeamB)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.