drop table if exists cp_test; create table cp_test( `f1` int(11) not null, `f2` char(2) not null, `f3` varchar(6) not null, `f4` varchar(5) default null, `f5` varchar(2) default null, `f6` varchar(10) default null, `f7` char(2) default null, `f8` varchar(6) default null, `f9` varchar(6) default null, `f10` char(2) default null, `f11` varchar(10) default null, `f12` varchar(10) default null, primary key(`f1`), key `idx`(`f2`, `f3`, `f4`, `f5`, `f6`, `f7`, `f8`, `f9`, `f10`, `f11`, `f12`) ) engine=MyISAM default charset=latin1; insert into cp_test values (25490,'US','99573','MXWEL','R','60', null,'RR', null,null,'BOX','157'), (20321,'US','69101','JCKSN','S','2320',null,'BRCHWD','RD',null,null, null), (20331,'US','82221','NSHLS','R','77', null,'RR', null,null,'BOX','356') ; -- This will not return the row inserted above select f1 from cp_test where f2 = 'US' and f3 = '99573' and f4 = 'MXWEL' and f5 = 'R' and f6 = '60' and f7 is null and f8 = 'RR' and f9 is null and f10 is null and f11 = 'BOX' and f12 = 157; -- This will return the row inserted above select f1 from cp_test where f2 = 'US' and f3 = '99573' and f4 = 'MXWEL' and f5 = 'R' and f6 = '60' and f7 is null and f8 = 'RR' and f9 is null -- and f10 is null and f11 = 'BOX' and f12 = 157;