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 

slq for orphans

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Bill Todd
Guest





PostPosted: Fri Nov 12, 2004 3:04 pm    Post subject: Re: slq for orphans Reply with quote



Try the following:

SELECT PK, FK
FROM DETAIL D LEFT OUTER JOIN MASTER M
ON D.FK = M.PK
WHERE M.PK IS NULL

--
Bill (TeamB)
TeamB cannot answer questions received via email
Back to top
Terry
Guest





PostPosted: Fri Nov 12, 2004 3:56 pm    Post subject: slq for orphans Reply with quote



I would like to create a sql select which selects the orphans in a detail
table.
as in
select * from detailtbl
where detailtbl.id not in mastertbl

mastertbl.id is a primarykey
detailtbl.id links many records to one record in mastertbl





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) 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.