Key ParentKey GroupName
I I C(50)
and that table has order by ParentKeySELECT Table_A SET ORDER TO ParentKey CREATE CUROSOR MyCursorForInfo (structure here, don't forget to put some Group field(s)) GetInfoFromThatTable() FUNCTION GetInfoFromThatTable(lnKey) LOCAL lnRecNo SELECT Table_A IF VARTYPE(lnKey) # [N] && If the type of key field is Numeric of course GO TOP && All main keys must have parent key = 0 SCAN WHILE ParentKey == 0 && Scan for MainKeys If you have order lnRecNo = RecNo() **** Get Info from Product table for that Key INSERT INTO MyCursorForInfo ...... GetInfoFromThatTable(Table_A.Key) GOTO lnRecNo ENDSCAN ELSE SEEK m.lnKey SCAN WHILE ParentKey == m.lnKey lnRecNo = RecNo() **** Get Info from Product table for that Key INSERT INTO MyCursorForInfo ...... GetInfoFromThatTable(Table_A.Key) GOTO lnRecNo ENDSCAN ENDIF RETURN Something like that. >Hi friends, > >I use to create one table for each information like this: ><pre> >Table_A Table_B Table_C >ID_A 1-------+ ID_B 1--------+ ID_C >GroupName | SubGroupName | ProductName > +----N ID_A +---N ID_B >>
>Table_A Table_C
>ID_A 1-------+---+ ID_C
>GroupName | | ProductName
>ID_A_Main N--+ +---N ID_A
>
>