Results 1 to 2 of 2

Thread: Joining fields

  1. #1
    Join Date
    Aug 2005
    Location
    Delaware
    Posts
    139

    Unanswered: Joining fields

    Hello;

    Is it possible to join two tables with similar but not exact field data? I have one table that has a field { [CaseNumber] } which consists of an alpha numeric number (ABC######, and a second table which has the same configuration (ABC###) { [AgentNumber] } however only the alpha portions are the same. Also, the numeric portions are of different lengths in each file.

    So, what I need to do is join the two tables using only the first 3 alpha characters of both fields. Is this possible? If so, how would I do that?

    Thanks...

    Larry

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT...
      FROM table1
    INNER
      JOIN table2
        ON LEFT(table2.AgentNumber,3) = LEFT(table1.CaseNumber,3)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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