获取以前的SQL值 [英] Get previously value SQL

查看:144
本文介绍了获取以前的SQL值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子,如下图所示。当当前速率值为空时,我想获得先前的速率值。这意味着表中的最后一个比率应该具有值7.6。那可能吗?



Valuta汇率Dato

EUR 7.5 2014-10-13

EUR 7.9 2014-10-14

EUR 7.6 2014-10-18

EUR 2014-10-20

EUR 2014-10-21

I have a table looking like down below. I would like to get the previously rate value when the current rate value is null. Which mean that the last to rates in the table should have the value 7.6. Is that possible?

Valuta rate Dato
EUR 7.5 2014-10-13
EUR 7.9 2014-10-14
EUR 7.6 2014-10-18
EUR 2014-10-20
EUR 2014-10-21

推荐答案

select top 1 * from table1 where rate is not null order by date desc


这篇关于获取以前的SQL值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆