Can any one tell me What diffrence bitween these two mysql operators :-
<=> and =
Both are getting same results. Are they same in use.
select s.dwt,s.shipnam from tbl_ship s
where s.dwt >= 1 and s.deleted = 'N'
and s.dwt = 11000
group by s.co_cod
and
s开发者_运维知识库elect s.dwt,s.shipnam from tbl_ship s
where s.dwt >= 1 and s.deleted = 'N'
and s.dwt <=> 11000
group by s.co_cod
Thanks.
<=>
is NULL-safe equal to operator.
It is null safe equal to operator :
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_equal-to
From mysql documentation :
mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
-> 1, 1, 0
mysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;
-> 1, NULL, NULL
<=> NULL-safe equal to operator
That's why. You probably wanted to use <>
or !=
to test for inequality.
http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html#operator_equal-to
精彩评论