MYSQL中在select时对NULL值的发现
MYSQL中,在select时对两个同为NULL值的字段竟然不匹配。记录一下。drop table if exists test1 ;create table test1(id int (11),name char(20))ENGINE=MyISAM DEFAULT CHARSET=utf8 ;drop table if exists test2 ;create table test2(id int (11),name char(20))ENGINE=MyISAM DEFAULT CHARSET=utf8 ;insert into test1 values( 1,'javaliujie' ) ;insert into test1 values( 2,NULL ) ;insert into test1 values( 3,NULL ) ;insert into test1 values( 4,'' ) ;insert into test1 values( 5,'' ) ;insert into test2 values( 1,'javaliujie' ) ;insert into test2 values( 2,NULL ) ;insert into test2 values( 3,NULL ) ;insert into test2 values( 4,NULL ) ;insert into test2 values( 5,'' ) ;mysql> select * from test1,test2 where test1.id=test2.id and test1.name=test2.name ;+------+------------+------+------------+| id | name | id | name |+------+------------+------+------------+| 1 | javaliujie | 1 | javaliujie || 5 | | 5 | |+------+------------+------+------------+2 rows in set (0.00 sec)
页:
[1]