使用 DAO 选择具有最高时间戳的给定 ID 的记录
Select the record of a given id with the highest timestamp using DAO
如何在记录集上使用DAO执行以下操作
SELECT TOP 1 * FROM foo WHERE id = 10 ORDER BY timestamp DESC
使用 SetCurrentIndex,您只能使用一个索引,否则使用 id 和时间戳,选择第一个就可以了。
我不确定你想要什么。
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDB
sSQL = "SELECT TOP 1 * FROM foo WHERE id = 10 ORDER BY timestamp DESC"
Set rs = db.OpenRecordset(sSQL)
查找不适用于所有记录集。这将起作用:
Set rs = CurrentDb.OpenRecordset("select * from table1")
rs.FindFirst "akey=1 and atext='b'"
If Not rs.EOF Then Debug.Print rs!AKey
这不会:
Set rs = CurrentDb.OpenRecordset("table1")
rs.FindFirst "akey=1 and atext='b'"
相关文章:
- 将两个数组中的差异记录在第三个数组中
- 从函数角度看ID到文件路径的内部与外部映射
- 通过组合不同的类型来创建唯一的id
- 我不断收到 [错误] ID 返回 1 退出状态错误,但看不到问题所在
- FFMPEG配置文件级别id大小无效
- 方法内部但循环仍得到预期的不合格id错误C++
- 如何获取 GLFW 窗口 ID?
- 当简单捕获中的标识符显示为参数的声明符 ID 时,没有编译器诊断
- 显示数组中的学生 ID 和最高分
- C++:"("令牌"之前有预期的非限定 id 指向类中成员函数的指针
- 在PostgreSQL中根据它们的ID选择大量行的最快方法是什么?
- Xcode 9.4.1 中的 Apple Mach-O 链接器 (id) 错误
- 禁止在控制台上记录谷神星
- 创建 Spdlog 异步文件记录器时遇到困难
- fastrtps:如何在发布/订阅级别使用 DDS 历史记录?
- 错误:令牌 { '{' 之前应存在非限定 ID
- 我想使用 C++ 从 excel 获取记录,并希望使用特定的列数据(例如书籍 ID)控制输出
- 如何使用ID搜索记录
- 获取 id 字段作为 QSqlTableModel 中记录的整数
- 使用 DAO 选择具有最高时间戳的给定 ID 的记录