Dim tb As Table = Tables(e.Form.Name & "_Table1")
Dim cmd As New SQLCommand
cmd.C
Dim fi As String = " and 仓库名称 = '" & e.Form.Controls("Comb仓库选择").text & "' and JCCDate BETWEEN '" & e.Form.Controls("Date开始日期").Value & "' and '" & e.Form.Controls("Date结束日期").Value & "'"
cmd.CommandText = "SELE CT JCCDate,SUM(JCC数量) AS 进仓数量, 0 as 出仓数量 FROM {KC_JCCMX} where jcc数量 > 0 " & fi & " GROUP BY JCCDate union all "
cmd.CommandText &= "SEL ECT JCCDate,0 as 进仓数量,SUM(JCC数量) AS 出仓数量 FROM {KC_JCCMX} where jcc数量 < 0 " & fi & " GROUP BY JCCDate "
tb.DataSource = cmd.ExecuteReader
Dim sdt As DataTable = cmd.ExecuteReader
此主题相关图片如下:20220705.png
老师,我想要的结果如下图。
此主题相关图片如下:2022070502.png
[此贴子已经被作者于2022/7/5 14:10:16编辑过]