本文介绍了如何在最近[CLOCK]时间内针对TAG_ID获取最新的TAG_VAL之一。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨伙计,
如何通过最新[时钟]更新时间对tag_id获取最新[tag_val]之一。
随后粘贴了2张图片。
您的早期回复会很明显。
非常感谢提前参考oracle表格。
Hi dude,
How to get one of latest [tag_val] against tag_id by latest [clock] updated time.
There are 2 images are pasted followed.
Your early reply would be appreciable.
Very thanks in advance refer following oracle table.
NAME CLOCK TAG_VALUE TAG_ID
T1 10/08/20159:13:51AM 1.020 20
T1 10/08/20159:13:50AM 102.4 20
T1 10/08/20159:13:49AM 1.020 20
T1 10/08/20159:12:50AM 102.4 19
T1 10/08/20159:12:50AM 102.4 19
T1 10/08/20159:12:10AM 302.4 18
T1 10/08/20159:12:50AM 102.4 19
T1 10/08/20159:11:40AM 602.4 17
T1 10/08/20159:10:39AM 702.4 17
SHOUTING删除 - OriginalGriff [/ edit]
[edit]SHOUTING removed - OriginalGriff[/edit]
推荐答案
SELCT [NAME],[CLOCK],[TAG_VALUE],[TAG_ID]
FROM
(
SELECT [NAME],[CLOCK],[TAG_VALUE],[TAG_ID],DENSE_RANK() OVER (PARTITION BY [TAG_ID] ORDER BY [CLOCK] DESC) "slno"
FROM MyTable
) T
WHERE slno=1
希望,它有帮助:)
Hope, it helps :)
这篇关于如何在最近[CLOCK]时间内针对TAG_ID获取最新的TAG_VAL之一。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!