【发布时间】:2022-07-06 18:53:52
【问题描述】:
我必须从下面提到的表格中获取数据。如您所见,Entry Type 有两种类型:完整的数据备份和日志备份。我只需要根据时间戳查询其中任何一个的最新成功和错误的一个条目。
所以我需要的输出是:
Success complete data backup 2022-07-11 15:27:10(this is the latest entry of this type.)
Error complete data backup 2022-07-06 15:28:37(this is the latest entry of this type.)
Success log backup 2022-07-29 15:27:16(this is the latest entry of this type.)
Error log backup 2022-07-28 15:28:29(this is the latest entry of this type.)
到目前为止我已经尝试过了
"SELECT ENTRY_TYPE_NAME, Status, TimeStamp from M_BACKUP_CATALOG where Status='Success' OR Status='Error' order by TimeStamp DESC"
但它会按降序显示所有条目。而我只想要我表中的两个 entry_type_name(完整数据备份和日志备份)的一个成功和一个错误。
【问题讨论】:
标签: sql