我正在尝试编写一个脚本,该脚本将返回一个独特的 documentid-physician-patient 三元组的最新值。我需要脚本的行为类似于 group by 语句,除了 group by 一次只能处理一列。我只需要最新的唯一三胞胎的日期和状态信息。请让我知道您需要从我这里得到什么帮助。这是当前非常简单的声明:
SELECT
TransmissionSend.CreateTimestamp,
TransmissionSendItem.Status,
TransmissionSendItem.PhysicianId,
TransmissionSendItem.DocumentIdDisplay,
Utility.SqlFunctions_NdnListToAccountList(TransmissionSendItem.NdocNum) AS AccountNum
FROM
Interface_SFAX.TransmissionSend,
Interface_SFAX.TransmissionSendItem
WHERE
TransmissionSend.ID = TransmissionSendItem.childsub --I don't know exactly what this does, I did not write this script. It must stay here though for the exact results.
ORDER BY TransmissionSend.CreateTimestamp DESC -- In the end, each latest result of the unique triplet will be ordered from most recent to oldest in return
我的问题是,我如何才能将结果限制为每个医生 ID、文档 ID 和帐号组合的最新状态?