Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to report parent records with no children.

Status
Not open for further replies.

Peager

Programmer
May 27, 2003
140
US
What's the best way to select records from a parent file that have no corresponding children in another file? I'm trying something like this but it's VERY slow.

Select Account, Company
From Customer
Where (Company + Convert(Seq_No,SQL_Char))
Not in (Select Distinct Company +
Convert (Seq_No,SQL_Char)
From Labels)

Customer is the parent, Labels is the child and they are related on Customer + Seq_No.

Thanking all in advance.

Paul
 
I think you mean that they are NOT related.

Just join the 2 tables in Crystal using a left outer and then add to the report->edit selection formula->Record

isnull(child.Customer)
or
isnull(child.Seq_No)

This assumes that neither is null in the parent table.

Should be quick.

-k
 
Sometimes I try really hard to make something difficult that is Soooooooo easy. Thanks for being gentle with my stupidity.

paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top