I need to update code1 and code2 in table2 from table1.
Code1 and Code2 of table2 must receive the values in table one according to the counts field for example -- The first record of table1 tells me that the first 5 records of table2 that have a matchfld of "fname1" - update code1 with "ABCD" and code2 with "1", Then the next record in table1 tells me the next 3 records of table2 (not coded with a matchfld of "fname1") I need to update code1 with "ABCD" and code2 with "2" and so on.
TABLE2 will be in order by matchfld. TABLE1 will be in order by matchfld and code2.
This is a small sample as the actual data in table 2 may contain
hundreds of thousands of records. Please help!
TABLE1
counts code1 code2 matchfld
5 ABCD 1 fname1
3 ABCD 2 fname1
7 EFGH 1 fname2
2 EFGH 3 fname2
TABLE2
matchfld code1 code2 product
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno
Code1 and Code2 of table2 must receive the values in table one according to the counts field for example -- The first record of table1 tells me that the first 5 records of table2 that have a matchfld of "fname1" - update code1 with "ABCD" and code2 with "1", Then the next record in table1 tells me the next 3 records of table2 (not coded with a matchfld of "fname1") I need to update code1 with "ABCD" and code2 with "2" and so on.
TABLE2 will be in order by matchfld. TABLE1 will be in order by matchfld and code2.
This is a small sample as the actual data in table 2 may contain
hundreds of thousands of records. Please help!
TABLE1
counts code1 code2 matchfld
5 ABCD 1 fname1
3 ABCD 2 fname1
7 EFGH 1 fname2
2 EFGH 3 fname2
TABLE2
matchfld code1 code2 product
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname1 doda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname2 deda
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno
fname3 ohno