统计不同产品的销售数量和金额:
Dim dtb As New
DataTableBuilder("统计")
dtb.AddDef("产品", Gettype(String), 16)
dtb.AddDef("数量", Gettype(Integer))
dtb.AddDef("金额", Gettype(Double))
dtb.Build()
For Each nm As String In DataTables("订单").GetUniqueValues("","产品")
Dim dr As
DataRow = DataTables("统计").AddNew()
dr("产品") = nm
dr("数量") = DataTables("订单").Compute("Sum(数量)","[产品] = '" & dr("产品") & "'")
dr("金额") = DataTables("订单").Compute("Sum(金额)","[产品] = '"
&
dr("产品") &
"'")
Next
MainTable= Tables("统计")
看下,帮助有很多这些例子