如何比较两列以查找MySQL中不匹配的记录 [英] How to compare two columns to find unmatched records in MySQL

查看:125
本文介绍了如何比较两列以查找MySQL中不匹配的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含2列的MySQL表,每列有数千条记录

I have a MySQL table with 2 columns and each column has thousands of records

例如,第1列中的15000电子邮件地址和第2列中的15005电子邮件地址

For Example 15000 Email addresses in Column1 and 15005 Email addresses in column 2

如何从15005中找到第1列中不匹配的5条记录?

How to find those 5 records from 15005 which are unmatched in column1?

我希望MySql查询能够比较两列,并只给出5条不匹配记录的结果

I wish MySql query to compare both columns and give result of only 5 unmatched records

谢谢

推荐答案

不确定我是否正确...但是会是这样吗?

Not sure if I got it right... but would it be something like?

select column2 from table
where column2 not in (select column1 from table)

这篇关于如何比较两列以查找MySQL中不匹配的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆