这个问题分两种情况,如果你的user表中是每个人的电话只存一行,那么也就是说一行的数据记录中一个phone字段可能存了很多个电话号码,形式类似于
user_id phone
人1 1111,2222,3333,4444
如果是当一个人有多个号码时被多行存储,形式类似于
user_id phone
人1 1111
人1 2222
人1 3333
人1 4444
这两种情况下的处理方法是不同的,第二种相对简单,第一种就麻烦一些,要先通过逻辑处理将数据整理成第二种形式再做查找。
select DISTINCT phone from user order by phone
然后把查询出来的数据复制到Excel表中再去对就好了
这是最好的方法
select phone from user
where phone in
( 111,2222,333,,44,555,···)
select phone from (
select '1111' phone from user
union
select '222' phone from user
union
....
select '10000' phone from user ) not in (select phone from user)