してみてください:
;with T as(
select *, ROW_NUMBER() over (order by User, Days) Rnum from YourTable
)
select
distinct a.User,
b.Days-a.Days difference_in_day
from T a left join T b on a.Rnum=b.Rnum-1
where b.User is not null
サンプル
declare @tbl as table(xUser nvarchar(1), xDays int)
insert into @tbl values
('A', 1),
('A', 1),
('A', 2),
('B', 2),
('B', 5)
select *, ROW_NUMBER() over (order by xUser, xDays) Rnum from @tbl
;with T as(
select *, ROW_NUMBER() over (order by xUser, xDays) Rnum from @tbl
)
select
distinct a.xUser,
b.xDays-a.xDays difference_in_day
from T a left join T b on a.Rnum=b.Rnum-1
where b.xUser is not null