declare @MyTable table ( -- Stuff you should be supplying
code int not null,
month char(6) not null,
value int not null
)
insert into @MyTable (code, month, value)
values
(1234, '201201', 75),
(1234, '201202', 95),
(1234, '201203', 80)
;with Ordered -- Possible solution
as (
select code, month, value, row_number() over (partition by code order by month) rn
from @MyTable
)
select
a.code, a.month, a.value - b.value value
from
Ordered a
inner join
Ordered b
on a.code = b.code
and a.rn = b.rn + 1
=================================================
There are two kinds of light -- the glow that illuminates, and the glare that obscures. -James Thurber