--
for each s as string in datatables("表C").getvalues("第一列")
dim dr1 as datarow = datatables("表C").find("第一列=\'" & s & "\'","_sortkey desc")
dim i as integer = tables("表C").findrow(dr1)
dim r as row
if i < tables("表C").rows.count - 1 then
tables("表C").position = i+1
r = tables("表C").insertnew
else
r = tables("表C").addnew
end if
r("第一列") = s
r("xx数量") = datatables("表xx").compute("sum(xx数量)”,"单位 in (\'" & datatables("表C").getcombostring("第二列","第一列=\'" & s & "\'").replace("|","\',\'") & "\')")
next