1. SQC Related Queries
1.1. Yield Detail Report by Customer By Date Range query
 

SELECT Custname, Qainsp.Wono, Part_no, Revision, LotSize, InspQty, FailQty, PassQty, Yield, Dept_name, Date, Qaseqmain AS QALink ;
 FROM Qainsp, Woentry, Inventor, Customer, Depts ;
 WHERE Inventor.Uniq_key = Woentry.Uniq_key ;
 AND Woentry.Custno = Customer.Custno ;
 AND Qainsp.Wono = Woentry.Wono ;
 AND Qainsp.Dept_id = Depts.Dept_id ;
 AND Date >= dStart AND Date <= dEnd ;
 AND Qainsp.Dept_id IN (SELECT Dept_id FROM ZD) ;
 AND Woentry.Custno IN (SELECT Custno FROM ZCu) ;
 AND Qainsp.Wono IN (SELECT Wono FROM ZW) ;
 ORDER BY Date, Custname, Part_no ;
 INTO CURSOR ZYieldDt

1.2. 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