以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [原创] 一个数据表中,如何求到除自己之外的最大数值  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=107803)

--  作者:2900819580
--  发布时间:2017/10/10 14:59:00
--  [原创] 一个数据表中,如何求到除自己之外的最大数值

For i As Integer = 0 To tb.Rows.Count - 1
    Dim r As Row = tb.Rows(i)
        Dim max2 As Double = dt2.Compute("max(单价)","物料代码 =\'" & r("物料代码") & "\'")
    r("最大单价") = max2

next

 

因为最近物料上涨,所以单价得到的数据都是自己行的单价!如何得到除自己行之外的最大值

[此贴子已经被作者于2017/10/10 14:59:30编辑过]

--  作者:有点甜
--  发布时间:2017/10/10 15:03:00
--  
Dim max2 As Double = dt2.Compute("max(单价)","物料代码 =\'" & r("物料代码") & "\' and _Identify <> " & r("_Identify"))
--  作者:2900819580
--  发布时间:2017/10/10 15:18:00
--  

老师,如何得到最近单价


--  作者:有点甜
--  发布时间:2017/10/10 15:20:00
--  

Dim fdr As DataRow = dt2.Find("物料代码 =\'" & r("物料代码") & "\'", "日期 desc")

If fdr Isnot Nothing Then

    msgbox(fdr("单价"))

End If

[此贴子已经被作者于2017/10/10 15:20:28编辑过]

--  作者:有点甜
--  发布时间:2017/10/10 15:21:00
--  

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