I don't have your tables, bat I can try to help you.
I would try to use for exampl> SELECT * FROM table WHERE parents IN(SELECT parents FROM table_parents WHERE (....) )
If I understand your question correctly and you have a parent table and a child table, join the two tables with an INNER JOIN. This will retrieve only the parent records that have at least one associated child record.
Example:
SELECT * FROM DT_PERSON P INNER JOIN DT_QUALIFICATION Q ON P.Person_ID = Q.Person_ID
If you use a LEFT OUTER JOIN, then parent records without any child records would also be retrieved.
I hope this helps.
Mark
David try this
HTH Mike
IF Object_ID('TempDB..#Parent')>0 DROP TABLE #ParentIF Object_ID('TempDB..#Child') > 0 DROP TABLE #Child CREATE TABLE #Parent( Pk int, OtherStuff VarChar(20)
)
CREATE TABLE #Child(
FKParent int
DECLARE @Count intSet @Count = 0While @Count <10BeginSet @Count = @Count + 1 INSERT INTO #Parent(PK) VALUES(@Count) IF @Count < 5 INSERT INTO #Child(FKParent) VALUES(@Count)EndGOSELECT P1.pKFROM #Parent p1WHERE NOT EXISTS ( SELECT p.pk FROM #Child c JOIN #Parent p ON c.FKParent = P1.pk  
--/*
Results 5,6,7,8,9,10
Records 1-4 have parents
Edited to change Mark to David. Addressed the wrong person sorry
*/
If you cut and paste my code you will have to insert a ) at the end of the second select statement. Love those expressions
Mike
SHAPE { SELECT * FROM DT_PERSON where exists (select * from DT_QUALIFICATION q where DT_PERSON.PersonID = q.Person_ID) } APPEND({SELECT * FROM DT_QUALIFICATION} RELATE Person_ID TO Person_ID) AS ChildRS
Would something like that works?