Foxtable(狐表)用户栏目专家坐堂 → 有个合并统计问题请教各位老师


  共有4726人关注过本帖平板打印复制链接

主题:有个合并统计问题请教各位老师

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/10/3 12:55:00 [只看该作者]

 参考下面的代码

Dim s_date As Date = new Date(2013, 9, 24)
Dim e_date As Date = new Date(2013, 9, 27)
Tables("统计").StopRedraw
Dim filter As String = " 发货日期 >= #" & s_date & "# and 发货日期 <= #" & e_date & "#"
Dim dt As DataTable = DataTables("历史运单")
Dim aList As List(of String) = DataTables("历史运单").GetUniqueValues(filter,"装车线路")
If aList IsNot Nothing Then
    For Each s As String In aList
        Dim dr As DataRow = DataTables("统计").AddNew
        dr("装车线路")=s
        dr("黄村1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 = '黄村(京)' and " & filter)
        dr("黄渡1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 = '黄渡(上)' and " & filter)
        dr("其他站点1")=dt.Compute("count(到站)","装车线路='" & s & "' and 到站 <> '黄渡(上)'and 到站 <> '黄村(京)' and " & filter)
        dr("黄村2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 = '黄村(京)' and " & filter)
        dr("黄渡2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 = '黄渡(上)' and " & filter)
        dr("其他站点2")=dt.Compute("sum(装车数量)","装车线路='" & s & "' and 到站 <> '黄渡(上)'and 到站 <> '黄村(京)' and " & filter)
    Next
End If
Tables("统计").ResumeRedraw

 回到顶部
总数 13 1 2 下一页