INNER JOIN field with different data type

  • Thread starter Thread starter gan
  • Start date Start date
G

gan

Hi, I'd like to INNER JOIN 2 table. Say that using table1.Field1 and
table2.Field2.
However, Field1 from table A is in numeric format and Field2 is in text
format (where the value stored might be '1' instead of 1).

If is possible for me to "convert" the value in Field1 to text and perform
an INNER JOIN? or any other idea?

Thanks in advanced!
 
I convert the Text Field to Long and use it in the ON
Clause without any problems (tested in AXP).

Here the SQL String that works:

SELECT Table1.ID, Table1.Text1, Table1.Long1, Table2.Field1
FROM Table1 INNER JOIN Table2
ON Table1.ID = CLng(Table2.ID);

Table1.ID is AutoNumber and Table2.ID is Text (with digits
only)

Alternatively, you can use the WHERE Clause to specify
your join criteria.

HTH
Van T. Dinh
MVP (Access)
 
Back
Top