From: Peter Brawley Date: March 4 2010 8:07pm Subject: Re: 5.1.44 community version select ordno>=' ' error (2) List-Archive: http://lists.mysql.com/mysql/220857 Message-Id: <4B9012EF.2040505@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------010409020401050409030508" --------------010409020401050409030508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Wang, > select * from t1 where ordno>=' ' gets wrong result 2 rows I doubt you'll get many helpful responses till you post the INSERTs. PB ----- wang shuming wrote: > Oh, > If any char fields add to index key ,then the >=' ' gets wrong . > > ordno, qty ,mem > 1 > 3 > 5 > aaa 18 > bbbbb 20 > > 1. CREATE TABLE `t1` ( > `mid` int(11) NOT NULL, > `qty` decimal(12,2) NOT NULL DEFAULT '0.00', > `ordno` char(8) NOT NULL DEFAULT '', > `mem` char(1) DEFAULT '', > PRIMARY KEY (`mid`), > KEY `key03` (`ordno`)) > > select * from t1 where ordno>=' ' > gets wrong result 2 rows > > 2CREATE TABLE `t1` ( > `mid` int(11) NOT NULL, > `qty` decimal(12,2) NOT NULL DEFAULT '0.00', > `ordno` char(8) NOT NULL DEFAULT '', > `mem` char(1) DEFAULT '', > PRIMARY KEY (`mid`)) > > select * from t1 where ordno>=' ' > gets OK 5 rows > > 3.CREATE TABLE `t1` ( > `mid` int(11) NOT NULL, > `qty` decimal(12,2) NOT NULL DEFAULT '0.00', > `ordno` char(8) NOT NULL DEFAULT '', > `mem` char(1) DEFAULT '', > PRIMARY KEY (`mid`), > KEY `key03` (`mem`)) > > select * from t1 where mem>=' ' > 0 rows wrong > > 4.CREATE TABLE `t1` ( > `mid` int(11) NOT NULL, > `qty` decimal(12,2) NOT NULL DEFAULT '0.00', > `ordno` char(8) NOT NULL DEFAULT '', > `mem` char(1) DEFAULT '', > PRIMARY KEY (`mid`)) > > select * from t1 where mem>=' ' > 5 rows OK > > Regards! > > Shuming wang > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.435 / Virus Database: 271.1.1/2721 - Release Date: 03/03/10 19:34:00 > > --------------010409020401050409030508--