Dim b As New SQLGroupTableBuilder("统计表1" ,"ACCxmdjb")
b.C
b.AddTable("ACCxmdjb","ygxm","ACCygdjb","ygxm")
b.Groups.AddDef("{ACCygdjb}.sszy","专业")
b.Groups.AddDef("{ACCygdjb}.ygxm","员工姓名")
b.Totals.Addexp("sygxs","IIF(sfsjwj = False And chqx = False,[gxs] - [ychx] - [echx] - [schx] - [sichx] - [wchx],0)","待完成工时")
b.Build
MainTable=Tables("统计表1")
Tables("统计表1").Sort = "专业,sygxs"
如果是SqlServer,把IIF改为使用case when语法