Dim b As New SQLGroupTableBuilder("统计表1","A") b.Groups.Adddef("产品型号") b.Totals.Addexp("合格数","iif(是否合格 = True,1,0)") b.Totals.Addexp("不合格数","iif(是否合格 = True,0,1)") b.Totals.AddDef("产品编号",AggregateEnum.Count,"合计") b.Filter = "产品型号 Is not Null" b.Build() MainTable = Tables("统计表1")