字段:
产品编号、产品名称、单价……---------------------------------------------------------------------
关联统计代码如下:
Dim st As Date = Date.Now
Dim b As New S Q LCrossTableBuilder("统计表1","销售明细表")
b.Connection Name = "数据源"
b.AddTable("销售明细表","产品编号","产品库","产品编号")
b.HGroups.AddDef("{销售明细表}.[客户编号]")
b.HGroups.AddDef("{产品库}.[单价]")
b.VGroups.AddDef("日期", DateGroupEnum.Year, "{0}年份")
b.VGroups.AddDef("日期", "{0}月份")
b.Totals.AddDef("{产品库}.[数量]")
b.Totals.AddExp("销售金额","{产品库}.[数量] * {产品库}.[单价]") '
b.Filter = "year(日期) = '2024' and month(日期) = 10"
b.Build
M aint able = Tables("统计表1")
MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒")
---------------------------------------------------------------------
问题如下:
当 b.Filter = "year(日期) = '2023' and month(日期) = '10'" 时,耗时 1 秒多(正常)
当 b.Filter = "year(日期) = '2023' and month(日期) = '11'" 时,耗时 65 秒多(异常)
当 b.Filter = "year(日期) = '2023' and month(日期) = 12" 时,耗时 68 秒多(异常)
当 b.Filter = "year(日期) = '2023' and month(日期) in ('10','11','12')" 时,耗时 1 秒多(正常)
请问这种情况会是什么原因导致的呢?目前还没找出原因所在