How to join on two disparate keys (one is string, other is int)?

I have two tables in MS Access that are suppose to share a common key...however the number in one is actually stored as a string while the other is stored as an int.

I think I want to use the convert() function...

Select blah1.key, blah2.key
from blah1
INNER JOIN
blah2
ON blah1.key = blah2.key

How do I use the convert() or something like it for the join?
LVL 2
M3hcSSAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
M3hcSSConnect With a Mentor Author Commented:
Solution was

JOIN Table2 ON Table2.CityList LIKE '%' + Table1.City + '%'
0
 
käµfm³d 👽Commented:
Either use CInt(strColumnName) or CStr(intColumnName).
Select blah1.key, blah2.key
from blah1
INNER JOIN
blah2
ON blah1.key = CStr(blah2.key)
 
--OR--
 
Select blah1.key, blah2.key
from blah1
INNER JOIN
blah2
ON CInt(blah1.key) = blah2.key

Open in new window

0
 
hnasrCommented:
You may need to create a query of any table changing the format of the relevant field.
Then join the query with the other table.
0
All Courses

From novice to tech pro — start learning today.