*** Just to define how many distinct names we have in child table SELECT MAX(Cnt) AS Cnt; FROM (SELECT Id, COUNT(DISTINCT cField1) AS Cnt; FROM ChildTable; GROUP BY Id) Tbl1; INTO CURSOR crsTest IF crsTest.Cnt = 0 MESSAGEBOX([What we must do now?]) RETURN ENDIF *** Creates a cursor where we will try to flat the Child table lcCreate = [CREATE CURSOR crsChid (Id int] FOR lnFor = 1 TO crsTest.Cnt lcCreate = lcCreate + [, pcField] +TRANSFORM(lnFor)+[ C(3)] NEXT lcCreate = lcCreate + [)] &lcCreate *** Get ALL distinct names from Child table SELECT DISTINCT Id, cField1; FROM ChildTable; ORDER BY Id; INTO CURSOR crsTest && crsTest is not needed anymore lnId = 0 lnNextField = 1 SCAN IF Id # m.lnId lnNextField = 1 lnId = crsTest.Id APPEND BLANK IN crsChid ENDIF lcFldName = [pcField]+TRANSFORM(lnNextField) REPLACE &lcFldName WITH crsTest.cField1 IN crsChid lnNextField = lnNextField + 1 ENDSCAN *** OK We Flated the cursor so the final result: SELECT *; FROM ParentTable; LEFT JOIN crsChild ON ParentTable.Id = crsChild.Id; INTO CURSOR crsFinalNot tested but you got the idea.