以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如何二列或多列之中不重复值的数量  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=97193)

--  作者:有点蓝
--  发布时间:2017/3/7 21:24:00
--  
分组统计:http://www.foxtable.com/webhelp/scr/0677.htm
--  作者:有点蓝
--  发布时间:2017/3/9 8:36:00
--  
上例子测试
--  作者:有点色
--  发布时间:2017/3/9 10:12:00
--  

参考

 

http://www.foxtable.com/webhelp/scr/2320.htm

 


--  作者:有点色
--  发布时间:2017/3/16 20:06:00
--  
Dim dt1 As DataTable = DataTables("表C")
Dim dt2 As DataTable = DataTables("表B")
Dim cnames() As String = {"大整数", "小整数"}
For Each cname As String In cnames
    For Each r As DataRow In dt1.Select("")
        If r.IsNull(cname & "_整数") Then
            r(cname & "_个数") = Nothing
        Else
            Dim count As Integer = 0
            For Each dc As DataCol In dt2.DataCols
                If dc.name.contains(cname) Then
                    For Each dr As DataRow In dt2.Select("")
                        If r(cname & "_整数") = dr(dc.name) Then
                            count += 1
                        End If
                    Next
                End If
                r(cname & "_个数") = count
            Next
        End If
    Next
Next

--  作者:有点色
--  发布时间:2017/3/17 1:18:00
--  

Dim dt1 As DataTable = DataTables("表C")
Dim dt2 As DataTable = DataTables("表B")


For Each r As DataRow In dt1.Select("")
    If r.IsNull("大整数_整数") Then
        r("大整数_个数") = Nothing
    Else
        Dim count As Integer = 0
        Dim cs() As String  = {"大整数1","大整数2"}
        For Each dc As String In cs
           
            For Each dr As DataRow In dt2.Select("")
                If r("大整数_整数") = dr(dc) Then
                    count += 1
                End If
            Next
           
            r("大整数_个数") = count
        Next
    End If
Next

 


--  作者:有点色
--  发布时间:2017/3/17 2:57:00
--  
For Each r As Row In tb6.Rows
    If r.IsNull("球号") Then
        r("出现次数") = Nothing
    Else
        Dim count As Integer = 0
        Dim cs() As String  = {"大整数1","大整数2"}
        For Each dc As String In cs
            For Each dr As Row In tb5.Rows
                If r("球号") = dr(dc) Then
                    count += 1
                End If
            Next
            r("出现次数") = count
        Next
    End If
Next