--测试环境
create table t1(id int)
create table t2(id int)
insert into  t1
select 1 union all
select 2 union all
select 3 union all
select 4 union all
select 5 union all
select 6 union all
select 7 insert into  t2
select 6 union all
select 9 
--sql
select distinct (select distinct t2.id  from  t1,t2 where t1.id=t2.id)as '有' ,
(select distinct id from  t2 where id not in(select id  from t1)) as  '无' 
from  t1,t2 
--删除环境
truncate table t1truncate table t2