Dim b As New sqlGROUPTableBuilder("按入职年度离职","人事信息表")
b.ConnectionName = "foxtable人事数据库"
b.Groups.AddDef("地区")
b.Totals.AddDef("员工编号",AggregateEnum.count)
'b.Totals.AddExp("胜利","case when ([是否在职] = 0 And [入职时间] < '" & y1 & "' and [离职时间] <= '" & y365 & "' and [离职时间] >= '" & y1 & "') Then 1 Else 0 end")
b.Filter = "是否在职 = 0 And [入职时间] >= '" & y1 & "' and [离职时间] <= '" & y365 & "' and [离职时间] >= '" & y1 & "'"
'b.Build '如果调用了BuildDataSource,这一句是多余的
Tables("根据入职年度分析_Table1").DataSource = b.BuildDataSource()
[此贴子已经被作者于2020/5/25 16:15:10编辑过]