select A.Field1, B.Field2, C.Field3, D.Field4, B.kBKey ; from AFile A ; join BFile B on B.kBKey1 = A.kAKey ; left join CFile C on B.kBkey2 = C.kCkey ; left join DFile D on B.kBKey3 = D.kDKey ; where A.AKey = ?gkKey ; order by C.Field3, D.Field4 ; into cursor T_res select kBKey from T_Res group by 1 into Cursor T_Key Select E.kBKey, SUM(E.Field5) ; from EFile E ; Join T_Key on E.kEKey = T_Key.kBKey ; Group by 1 ; into cursor T_SUM select Field1, Field2, Field3, Field4, aTotal ; from T_Res ; Join T_Sum ; on T_Res.kbKey == T_Sum.KbKeyperhaps create the T_RES already with the aTotal field and Readwrite for a later update.