Not weird at all... As you can see it returnet all rows where "iImo" equals 0... that is becuase of the CAST applied...
iImo is int(11) thus MySQL is casting 'FOOBAR' and the result is 0. Try: mysql> SELECT CAST('FOOBAR' AS UNSIGNED); MySQL will yell: +--------------------------------------+ | CAST('FOOBAR' AS UNSIGNED) | +--------------------------------------+ | 0 | +--------------------------------------+ 1 row in set (0.03 sec) I hope this is clear ! Gabriel PREDA www.amr.ro www.lgassociations.info dev.falr.ro ----- Original Message ----- From: "Mattias Håkansson" <[EMAIL PROTECTED]> To: <mysql@lists.mysql.com> Sent: Tuesday, April 05, 2005 12:19 PM Subject: Weird Query Result Hello, I'm using MySQL 4.0.20 on Linux and I am experiencing some problems with a query result. I have the following table structure: mysql> desc gen_Lloyds_vessel; +-----------------+----------+------+-----+---------------------+----------- -----+ | Field | Type | Null | Key | Default | Extra | +-----------------+----------+------+-----+---------------------+----------- -----+ | iLloydsvesselID | int(11) | | PRI | NULL | auto_increment | | cName | char(50) | | | | | | iImo | int(11) | | | 0 | | | cCountry | char(5) | | | | | | iYearbuilt | int(11) | | | 0 | | | cVesseltype | char(40) | | | | | | iEnteredby | int(11) | | | 0 | | | tEntered | datetime | | | 0000-00-00 00:00:00 | | | iUpdatedby | int(11) | | | 0 | | | tUpdated | datetime | | | 0000-00-00 00:00:00 | | +-----------------+----------+------+-----+---------------------+----------- -----+ 10 rows in set (0.00 sec) Look at the query below: mysql> SELECT cName,iImo FROM gen_Lloyds_vessel WHERE gen_Lloyds_vessel.iImo = 'FOOBAR'; +----------------------+------+ | cName | iImo | +----------------------+------+ | SSG EDWARD A. CARTER | 0 | | LYKES HERO | 0 | | PONL GENOA | 0 | | YM MILANO | 0 | | PONL NEWARK | 0 | | COSCO NORFOLK | 0 | | PONL JAKARTA | 0 | | PONL SYDNEY | 0 | | PONL GENOA | 0 | | PONL MARSEILLE | 0 | +----------------------+------+ 10 rows in set (0.07 sec) None of these iImo fields has the value 'FOOBAR' but still I receive these results. Anyone have a clue what is causing this? Thank you for your time, Mattias Håkansson -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]