--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

# A column dt1 DATETIME <without NOT NULL> or dt1 INTEGER NOT NULL would be harmless.
# MyISAM and InnoDB show the same wrong warning.
CREATE TABLE t1 ( dt1 DATETIME NOT NULL);

# This is needed.
SET SESSION SQL_MODE = 'NO_ZERO_DATE';

# With "WHERE t1.dt1 IS NULL" comes a wrong warning
# Warnings:
# Warning 1292    Incorrect datetime value: '0' for column 'dt1' at row 1
# "WHERE t1.dt1=t2.dt1" is harmless
SELECT COUNT(*) FROM t1
WHERE t1.dt1 IS NULL;
SELECT COUNT(*) FROM t1
WHERE t1.dt1 = '2001-01-01 17:33:00';

DROP TABLE t1;