with code below will delete data in test2 which is not expected
1) there is a clear syntax error in the subquery but not detected by intellisense
2) the query run fine and deleted the data in test2
create table test1 (RYear varchar(6))
insert into test1 (RYear)
values ('202107')
create table test2 (RMonth varchar(6))
insert into test2(RMonth)
values ('202108')
select * from test1
select * from test2
delete test2
where RMonth in (select RMonth from test1)
select * from test2