Results 1 to 2 of 2

Thread: Join two tables

  1. #1
    Join Date
    Sep 2006
    Posts
    2

    Unanswered: Join two tables

    Hi,

    I have two tables that i want to join. The columns in the tables have different data types.

    ZRFF table EDW table
    ---------- ------------
    1770 001770
    40 000040
    4560 004560

    How would i join the columns above? I would performing the query in ms access 2010.

    thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Well I suppose you could kludge it and coerce the data to be the same type, or heres a radical thought... uf tbe data should be matched, then it shoukd be the same dara type.. so make it the same data type.

    the kludge workaround would be to either firmat yhe number to a string or convert the string to the number
    join table2 on table1.thiscolumn = clng(table2.thatcolumn)
    OR
    join table2 on format(table1.thiscolumn, "000000") = table2.thatcolumn
    neither is especially satisfactory.
    If table2 has an alpha value I dont know howthe SQL engine will act
    if your numbers exceed 999999 then you will have problems.

    kludge workarounds are never a smart call, especially if they get left in production environments. Far smarter to fix the problem than let a kludge fester and your (possibly) ex colleagues think you were a numpty for letting such a kludge persust
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •