以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  列去重问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=187841)

--  作者:HJG_HB950207
--  发布时间:2023/8/16 11:22:00
--  列去重问题
高速路门架识别通过车辆,一是从车头记录车牌号;二是从车尾记录车牌号,也就是判断2次

表A:   车牌   通过时间

           A
           A
           B
           C
           :
           
请教老师:如何对该数据表去重, 即同一牌照车辆,如记录的通过时间相差在1分钟之内,只视同通过一次,相应去掉一条记录(保留其中任何一条记录都行)。
              


--  作者:有点蓝
--  发布时间:2023/8/16 11:48:00
--  
按车牌、通过时间排序,然后同一个车牌的第一个时间减去第二个时间进行判断,大概

dim t as table = tables("表A")
t.sort = "车牌,通过时间"

for i as integer = t.rows.count - 1 to 1
if t.rows(i)("车牌") = t.rows(i-1)("车牌") then
dim d1 as date = t.rows(i)("通过时间")
dim d2 as date = t.rows(i-1)("通过时间")
if (d1 - d1).TotalSeconds<= 60 then
t.rows(i).delete
end if
end if
next