Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012

    Lightbulb Unanswered: Inner Join with LIKE Syntax

    I have two tables with serial numbers, however one table has more digits for the serial number. Such as Table1.SerialNumber is 123456789 and Table2.SerialNumber is 345678. They match in the middle digits.

    Can you write a Join statement that matches Table2.SerialNumber with anypart of Table1.SerialNumber?

    Something like?

    FROM [Table1] INNER JOIN Table2 ON [Table1].[Serial Number] Like Table2.%[Serial Number]%;

    Obviously the above doesn't work because it doesn't like the % wildcards but this is what I am trying to do and I don't know if it is possible.

    Thanks - Jay

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    The correct syntax would be (for an Access query, not a pass-through):
    ON [Table1].[Serial Number] Like '*' & [Table2].[Serial Number] & '*';
    However this kind of operation is extremely inefficient.
    Have a nice day!

Posting Permissions

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