X++ Update_recordset 与表连接并获取最新记录

问题描述 投票:0回答:0

您好,我正在尝试使用 update_recordset 在表上进行记录更新 我想从我的连接表中获取最新记录,但我只检索最旧的记录。

由于 order by desc 不适用于 update_recordset,除了 select forupdate 之外,我还能采取什么其他方法?因为我正在处理一个有数百万条记录的表。

表1

维修ID 修复完成日期时间
1 2019-04-04 04:34:31.000
2 2020-04-05 05:14:31.000

表2

维修ID 上次修复交易日期时间
1 2019-04-04 04:34:31.000
1 2022-05-02 07:14:21.000
1 2023-06-04 09:34:11.000
2 2020-04-05 05:14:31.000
2 2023-07-01 01:34:21.000

尝试过这个代码

update_recordset Table1
        setting
            RepairCompletionDateTime = Table2.LastRepairTransactionDateTime 
        join Table2
            where  Table1.RepairID ==  Table2.RepairId;

        info(strFmt("Repair Completion Date FG : Number of records updated is %1."
            ,Table1.rowCount()));`

预期结果

维修ID 修复完成日期时间
1 2023-06-04 09:34:11.000
2 2023-07-01 01:34:21.000
microsoft-dynamics axapta x++
© www.soinside.com 2019 - 2024. All rights reserved.