Converting int to varchar data type in MySQL
<p>I have two tables. I need to compare two values but they are in different datatype in both the tables. In one table, it  is int and in another table it is varchar. I tried using varchar with cast(), but cast() does not work with varchar.  </p>

<p>My query is like following:</p>

<pre><code>select user.username, user_follow.object_id from user,user_follow
left join user_follow
ON cast(user_follow.object_id as varchar(25))= user.username
WHERE user.username= cast(user_follow.object_id as varchar(25));
</code></pre>

<p>Help please.
thanks.</p>