如何获得最新的日期价值
我有一个带有日期和价值的表,但是如何创建一个检查器以将值1给出最新记录的值1?
原始
StartDate | ClientId | Value | UpdateDate |
---|---|---|---|
01-10-2022 | 101 | 100 | 01-10-2022 |
01-10-2022 | 101 | 2001 200 | 11-10-2022 |
01-10-2022 | 101 | 300 | 20-10-2022 |
01-10-2022 01-10-2022 | 10222200 | 11-200 | 11-- 10-2022 |
01-10-2022 | 102 | 300 | 20-10-2022 |
更新
启动端 | 客户端 | 值 | 更新端口 | 过时 |
---|---|---|---|---|
01-10-2022 | 101 | 100 | 01-10-2022 | 0 |
01-10-2022 | 101 2001 2001 | 200 | 11-10-2022 | 0 |
01-2022 0 01-10 -2022 | 101 | 300 | 20-10-2022 | 1 |
01-10-2022 | 102 | 2002 200 | 11-10-2022 | 0 |
01-10-2022 | 102 | 300 | 20-10-2022 | 1 |
I have a table with a date and value , but how to i create a checker to give a value 1 to the most up to date record?
Original
StartDate | ClientID | Value | UpdatedDate |
---|---|---|---|
01-10-2022 | 101 | 100 | 01-10-2022 |
01-10-2022 | 101 | 200 | 11-10-2022 |
01-10-2022 | 101 | 300 | 20-10-2022 |
01-10-2022 | 102 | 200 | 11-10-2022 |
01-10-2022 | 102 | 300 | 20-10-2022 |
Updated
StartDate | ClientID | Value | UpdatedDate | outdated |
---|---|---|---|---|
01-10-2022 | 101 | 100 | 01-10-2022 | 0 |
01-10-2022 | 101 | 200 | 11-10-2022 | 0 |
01-10-2022 | 101 | 300 | 20-10-2022 | 1 |
01-10-2022 | 102 | 200 | 11-10-2022 | 0 |
01-10-2022 | 102 | 300 | 20-10-2022 | 1 |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用窗口的最大值:
Using windowed MAX:
这是一个精选语句,将产生您显示的输出 - 可以在数据顶部建立视图。
如果您希望将“过时的”指标作为数据库中的持续价值,请告知:
This is a select statement that will produce the output you're showing - this could be established as a view on top of your data.
If you're looking to maintain the "outdated" indicator as a persistent value in the DB, please advise: