我正在使用ConcatRelated()\ Dlist(有时我指的是源代码的Visual Objects)来处理下面的表格中的一些任务。我可以基于匹配键组合数据,虽然我想要做的是基于匹配键和我将用于确定哪条记录是最新的值组合数据。这样就可以放弃旧行,新行会收到Concat。
我能做什么。
Ticket | Name | Code2 | LastHop |
------------------------------------------------------
DBC123456 James 10101010 Mexico
DBC123457 James 10101010 Texas
DBC123459 James 10101010 Texas
DBC123457 Mike 10101011 Texas
DBC123459 Mike 10101011 Virginia
Table Main
Ticket | Name | Code2 | LastHop |
---------------------------------------------------------------------------
DBC123456,DBC123457,DBC123458 James 10101010 Mexico
DBC123457,DBC123459 Mike 10101011 Texas
我想做什么 '找到重复的Code2 '从各自的TicketNumber中删除DBC '比较现在剥离的票证的6位数,看看哪一个更高 '保留最高行信息,并将所有“旧”票号添加到最高票数
这样我总是拥有最新的数据和旧票号的跟踪
即
Ticket | Name | Code2 | LastHop |
--------------------------------------------------------------------------
DBC123459,DBC123456,DBC123457 James 10101010 Texas
DBC123459,DBC123457 Mike 10101011 Virginia
SELECT
sub.[Name],
sub.Code2,
sub.LastHop,
DList("Ticket",
"Query3",
"[Code2] = '" & sub.[Code2] & "'",
"Ticket")
AS Ticket
FROM
(SELECT
q.[Name],
q.Code2,
q.LastHop
FROM Query3 AS q
GROUP BY
q.[Name],
q.Code2,
q.LastHop
) AS sub
ORDER BY
sub.Code2;