--构造数据
select 1 id ,'张三1' name,'备注1' remark
into #A
union all select 2 ,'张三2','备注2'
union all select 3 ,'张三3','备注3'
union all select 4 ,'张三4','备注4'
union all select 5 ,'张三5','备注5'
select 1 Id , 1 Aid,'true ' 状态1,'false' 状态2
into #B
union all select 2 , 1,'false','false'
union all select 3 , 1,'false','false'
union all select 4 , 2,'true ','false'
union all select 5 , 2,'true ','false'
union all select 6 , 2,'true ','true '
union all select 7 , 3,'false','true '
union all select 8 , 3,'false','true '
union all select 9 , 4,'false','false'
union all select 10 , 5,'true ','true '
--查询
select *
from #A
where id in
(
select aid
from #B
where [状态1]='false' and [状态2]='true'
)