Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JOIN query with wildcard? 1

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a table which contains a record of transactions. One field within this table contains a truncated version of a product serial number for SOME records. Truncated serial numbers include the last 8 alphanumeric digits. Other records contain the full serial number. I need to duplicate the contents of this table in a new table where the serial number is no longer truncated. The truncated serial numbers are enough digits to insure that there are no duplicates.

I tried a join query with a wildcard; but, that did not work for me...
Example:
Code:
SELECT ledger.recno, ledger.post_date, ledger.code, customer.ser_no, ledger.amount, ledger.comment FROM 
ledger 
INNER JOIN customer 
ON 
%ledger.ser_no LIKE customer.ser_no

Thanks for any suggestions...

-Allen M
 
try this --
Code:
SELECT ledger.recno
     , ledger.post_date
     , ledger.code
     , customer.ser_no
     , ledger.amount
     , ledger.comment 
  FROM ledger 
INNER 
  JOIN customer 
    ON customer.ser_no LIKE CONCAT('%',ledger.ser_no)
:)

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top