Creating a column that'll show previous rates
Solution 1:
Possibly you could use lag
select *,
Lag(address,1,'0') over(partition by accountnumber order by validto) PreviousAddress
from address.NewAddress
Possibly you could use lag
select *,
Lag(address,1,'0') over(partition by accountnumber order by validto) PreviousAddress
from address.NewAddress