I am not sure if this can be done in SQL Query or not. I can do it EXCEL.
Query
SELECT
A,
B,
C,
D,
E,
F
from TableA
where D in ('MSD_CHANGE','MSD_CMT_CHANGE')
If field D contains MSD_CMT_CHANGE then in row above and right 1 = 7866
another words in excel language E1 = E2.
currently I take query data from SQL and run script in Excel to do it.
if I can do in SQL it would reduce my work load.
VBA Code:
Sub Test
Dim rng as Range, cl as Range
Set rng = Range("D2:D" & Range("D" & Rows.Count).End(xlUp).Row)
For each cl in rng
If cl = "MSD_CMT_CHANGE" AND cl.Offset(-1, 0) = "MSD_CHANGE" Then
cl.Offset(-1, 1) = cl.Offset(0, 1)
End If
Next cl
End Sub
Explanation
if field_D = MSD_CMT_CHANGE then
compare row above it if equal "MSD_CHANGE" then
cell E1 = E2.
I have over 5000 rows of data.
Check image below for better explanatation.

I’ve assumed that there is a column (in my example that column is
id) you order data by to get columnDappeared like this.In this example ID is a column you order data by
Here is a DEMO