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
 General SQL Server Forums
 New to SQL Server Programming
 Compare to see if string is contained in another

Author  Topic 

DaveBF
Yak Posting Veteran

89 Posts

Posted - 2011-04-12 : 13:58:36
I have a WHERE clause which is
WHERE table1.name = table2.name.

If table1.name contains 'Smith,Syvlia' I want it to match 'Smith,Sylvia M' in table2.name.

How do I do that?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-04-12 : 14:00:26
SELECT *
FROM table1
CROSS JOIN table2
WHERE table2.name LIKE table1.name + '%'
Go to Top of Page
   

- Advertisement -