Master Table (t1) +----------DetailTable (t2) +----------DetailTable (t3)ie:
Create Cursor table1 (pkid i, company c(10)) Create Cursor table2 (parentID i, task c(30), pctComp i) For ix=1 to 20 Insert into table1 values (m.ix,'Company'+Padl(m.ix,3,'0')) If m.ix%2=0 Insert into table2 ; values (m.ix, "Load Common Structure", 20) endif If m.ix%3=0 m.llTosCoin = ( Int(Rand()*100)%2 = 0 ) Insert into table2 ; values (m.ix, "Load Final Structure", ; Iif(m.llTosCoin,100,80)) endif EndFor Select t1.pkid, t1.Company, ; t2.Task as CommTask,t2.pctComp as Commpct, ; t3.Task as FinalTask,t3.pctComp as Finalpct ; from table1 t1 ; inner join table2 t2 on t1.pkid = t2.parentID ; and t2.task == "Load Common Structure" ; inner join table2 t3 on t1.pkid = t3.parentID ; and t3.task == "Load Final Structure" and t3.pctComp < 100Cetin