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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select ... WHERE LIKE (%Column Name%) 1

Status
Not open for further replies.

perfectchaoss

Programmer
Nov 6, 2002
44
US
Hi,
I have a query that I want to run that has two tables. The 1st table has an Identifier that is alwaya 13 digits long. The 2nd table contains the same ID's except sometimes they are incomplete. Even though the 2nd table is not 13 digits, they are unique and match up to a unique record on the first table. I want to query all the items in the first table that are in the second table.

table 1: Table 2:
ID: 000111222330 ID: 1112223

basically i want to
Select 1stTableID WHERE it is LIKE '%2ndTableID%'.

Thanks in advance
JF
 
Code:
Select t1.TableID from t1,t2
WHERE t1.tableid LIKE '%' + t2.TableID + '%'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top