update T1
set P1 = b.P1
from T1 a,(select RID,P1 from T1 where Year = 2004 and Month = 5) b
where a.RID = b.RID
and a.Year = 2004
and a.Month = 6
set P1 = b.P1
from T1 a,(select RID,P1 from T1 where Year = 2004 and Month = 5) b
where a.RID = b.RID
and a.Year = 2004
and a.Month = 6
from t1 a,(
select rid,p1 from t1 where [year]=2004 and [month]=5
)b
where a.RID = b.RID
and a.[Year] = 2004
and a.[Month] = 6
set P1 = a.P1
from T1 a inner join (select RID,P1 from T1 where Year = 2004 and Month = 5) b
on a.RID = b.RID
where a.Year = 2004
and a.Month = 6
where a.RID = b.RID
and a.Year = 2004
and a.Month = 6
set P1 = (select P1 from t1 where rid=a.rid and year=2004 and month=5)
from t1 a
where year=2004 and month=6
set P1 = b.P1
from T1 a inner join (select RID,P1 from T1 where Year = 2004 and Month = 5) b
on a.RID = b.RID
where a.Year = 2004
and a.Month = 6