select * from 表B
where a1 in (
select a1 from 表A where a=Temp
)