Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with finding strings...

Author  Topic 

SQL_Rookie
Starting Member

32 Posts

Posted - 2009-05-06 : 13:15:40
I have 2 tables with a string column ...say name and I want to find matches were both the names are a like or have part of one name n the other name column like...

TableA TableB
Bob Who is Bob
Jill Jill is over there
Jane Jane Smith

I want to find all the TableB records that "Contain" the TableA string?

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-05-06 : 13:24:36
SELECT * FROM [tableb] b, [tablea] a WHERE b.[column] LIKE '%' + a.[column];
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-06 : 13:55:46
Or use proper CROSS JOIN instead of old syntax?


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -