Defect Location Report by Customer by Assembly Query
 

  Qadefloc.LocQty, Qadefloc.Location, Qadef.DefDate, Depts.Dept_name, Depts.Number, Qadef.Wono ;
 FROM Customer, Inventor, Qadef, Support, Qadefloc, Woentry, Depts ;
 WHERE Customer.Custno = Woentry.Custno ;
 AND Woentry.Uniq_key = Inventor.Uniq_key ;
 AND Woentry.Wono = Qadef.Wono ;
 AND Qadef.Locseqno = Qadefloc.Locseqno ;
 AND Qadefloc.Def_code = LEFT(Support.Text2,10) ;
 AND Support.Fieldname = "DEF_CODE  " ;
 AND (DefDate >= (dStart) AND DefDate <= (dEnd)) ;
 AND Woentry.Custno IN (SELECT Custno FROM ZC) ;
 AND Qadefloc.ChgDept_id = Depts.Dept_id ;
 AND Qadefloc.ChgDept_id IN (SELECT Dept_id FROM ZD) ;
 ORDER BY CustName, Depts.Number, Part_no, Revision, Def_code ;
 INTO CURSOR Zqaloc