没别的啥,就是想写个sql语句
sql语句:
select * from
(select nodeId,max(UpdateTime)as UpdateTime
from JT_InspectNode_Update
where PathID in (1, 2)
and deltag = 0
and UpdateTime <=
(select MAX(UpdateTime)as UpdateTime
from JT_InspectNode_Update
where UpdateTime <= '2017-07-24 11:51:30')
group by nodeId) as t1,
(select * from JT_InspectNode_Update where PathID in (1,2) and deltag = 0)as t2
where t1.NodeId = t2.NodeId and t1.UpdateTime = t2.UpdateTime order by t2.NodeId
本文介绍了一个复杂的SQL查询案例,旨在从特定路径ID的数据集中选择最新的更新记录,并通过内联视图进行匹配,确保只获取到最新状态的数据条目。
637

被折叠的 条评论
为什么被折叠?



