mysql NULL值在CLAUSE中的位置 [英] mysql NULL value in where in CLAUSE
本文介绍了mysql NULL值在CLAUSE中的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何处理mysql 其中条款
how to deal with NULL value in mysql where in CLAUSE
我尝试
SELECT * FROM mytable WHERE field IN(1,2,3,NULL)
它不起作用
只能像:
SELECT * FROM mytable WHERE field IN(1,2,3) OR field IS NULL
我如何在WHERE IN
中运行它?有可能吗?
how can i get it work in WHERE IN
? it is possible ?
推荐答案
根据我的理解,您希望提取具有1,2,3和null值的每条记录.
As by my understanding you want to pull every record with 1,2,3 and null value.
我认为不可能在IN运算符中放入null.它期望值,并且null是..不是一个值.因此,您实际上必须将OR与null放置在一起才能获得所需的结果.
I don't think its possible to put null in the IN operator. Its expects values and null is well.. not a value. So You really have to put the OR with the null to get the desired result.
这篇关于mysql NULL值在CLAUSE中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文