SQL查询如何检查表中多个数据的存在的问题 [英] SQL Query Problem that how to check presence of multiple data in table

查看:273
本文介绍了SQL查询如何检查表中多个数据的存在的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像有产品表包含多个具有不同名称的产品一样,所以我有五个产品名称我要检查这五个产品是否已经存在于表中。

like there are product table which contains multiple products with different names, so I have five products name I want to check that did these five products already present in table or not.

推荐答案





Hi,

SELECT * FROM Table1 where Name in(select Name from Table2)



这将返回所有这些产品名称表2中显示了

如果你想选择那些不在表2中的那些那么




This will return All those product Name which is present in Table2
if you want to select those which is not in Table2 then

SELECT * FROM Table1 where Name not in(select Name from Table2)


这篇关于SQL查询如何检查表中多个数据的存在的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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