Home > Database > Mysql Tutorial > sql server not in 查询没结果

sql server not in 查询没结果

WBOY
Release: 2016-06-07 17:42:58
Original
1394 people have browsed it

sql server not in 查询没结果Posted on 今天使用SQL Server 时,遇到使用not in 和not exist的查询结果有差异:not in 查询没结果。 原因:not in 遇到null就不工作了。 摘录: SELECT foreignStockId Probably returns aNULL. Try IdStock Descr stock a N

sql server not in 查询没结果 Posted on

今天使用SQL Server 时,网站空间,遇到使用not in 和not exist的查询结果有差异:not in 查询没结果。

原因:not in 遇到null就不工作了。

摘录:

SELECT foreignStockId

Probably returns a NULL. Try

IdStock Descr stock

a NOT IN (x,y,NULL) Will always return no results as it is equivalent to

ax and ay and aNULL which is

true and true and unknown

Which evaluates to unknown under the rules of three valued logic.

I normally use NOT EXISTS for this type of query

stock.descr stock p

原文网址:

  ,服务器空间,香港服务器
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template