Camilla Brodén wrote:

Hi!
I am trying to do an inner join of two tables using a char(3) key. The field I am 
joining by contains integers with sometimes leading zeros.

If it is a char(3) field it contains characters, not integers.

The inner join works when the field is a full 3 character field, with for example  
566, but when it starts with a 0, it does not work anymore. Why is this?


If you are joining a CHAR(3) field to a INT(3) field, the INT(3) becomes a "CHAR(3)' for the join.
'013' is not equal to '13'.


Try casting the CHAR(3) to an int.

I would appreciate some help, thanx.
/Camilla

______________________________________________________________________
This e-mail has been scanned for all viruses by Excedo MailScreen,
powered by MessageLabs. Mailscreen stops both known and unkown viruses, visit: 
http://www.mailscreen.se
______________________________________________________________________






-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to