Create Cursor table2 (unit c(1), serial i)
Insert Into table1 Values ('a ','name1','license1')
Insert Into table1 Values ('a ','name2','license2')
Insert Into table1 Values ('a ','name3','license3')
Insert Into table1 Values ('b ','name4','license4')
Insert Into table1 Values ('b ','name5','license5')
Insert Into table1 Values ('c ','name6','license6')
Insert Into table1 Values ('c ','name7','license7')
Insert Into table1 Values ('c ','name8','license8')
Insert Into table1 Values ('c ','name9','license9')
Insert Into table1 Values ('c ','name10','license10')
Insert Into table1 Values ('c ','name11','license11')
Insert Into table1 Values ('c ','name12','license12')
Insert Into table1 Values ('d ','name13','license13')
Insert Into table2 Values ('a ',1)
Insert Into table2 Values ('a ',2)
Insert Into table2 Values ('b ',3)
Insert Into table2 Values ('c ',4)
Insert Into table2 Values ('c ',5)
Insert Into table2 Values ('c ',6)
Insert Into table2 Values ('c ',7)
Insert Into table2 Values ('d ',8)
Select *, Cast(Null As Int) As serial ;
FROM table1 ;
ORDER By unit ;
INTO Cursor crsResult ;
readwrite
Index On unit Tag unit
Select table2
Scan
Scatter Name o2
Select crsResult
Seek o2.unit
Locate For Isnull(serial) While unit = o2.unit
Replace serial With o2.serial
Endscan
Select crsResult
Set NullDisplay To ''
Browse