これが私のテストテーブルです:
CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`thetime` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `test` (`thetime`) VALUES ('2013-02-26 18:07:00');
INSERT INTO `test` (`thetime`) VALUES (NULL);
INSERT INTO `test` (`thetime`) VALUES (NULL);
SELECT * FROM テスト:
id | thetime
------------------------
1 | 2013-01-01 00:00:00
2 | null
3 | null
SELECT * from test where thetime <> '2013-01-01 00:00:00':
id | thetime
------------------------
empty result set
null
フィールドに値を持つ2つのレコードを取得することが期待されていますthetime
id | thetime
------------------------
2 | null
3 | null
なぜこの結果が得られないのか疑問に思っています。 null の値は '2013-01-01 00:00:00' とは異なります
誰でも知っていますか?
乾杯、マキシム