方式一:
判断A表中有多少条数据在B表中【存在】,并且显示这些数据–EXISTS语句
select
A.ID,
A.NAME
from
表A
where EXISTS(select * from 表B where A.ID=B.ID)
判断A表中有多少条数据在B表中【不存在】,并且显示这些数据–NOT EXISTS语句
select
A.ID,
A.NAME
from
表A
where NOT EXISTS(select * from 表B where A.ID=B.ID)
方式二:
select dataid ,if(dataid in (select ID from aip_1732602471460208641_file where ID IN (1095882,1095883)),"yes","no") from gf_file