There's a small possibility of this returning cases where you have items not exactly the same but still have the pattern within them.see this illustrationdeclare @Table1 table(Name varchar(30),Item varchar(1000))insert @Table1values('Bill','Orange'),('John', 'Lemon'),('Dan', 'Apple')declare @Table2 table(Name varchar(30),Item varchar(2000))insert @Table2values('John','Orange-Lemon'),('Dan', 'BananaOrange'),('Bill', 'Orange,Grape,Cherry'),('Rob', 'Kiwi'),('Dan','Pineapple')SELECT *FROM @Table2 t2INNER JOIN @table1 t1 ON t1.name = t2.name AND t2.Item LIKE '%' + t1.Item + '%'ORDER BY 1output--------------------------------------------Name Item Name ItemBill Orange,Grape,Cherry Bill OrangeDan Pineapple Dan AppleJohn Orange-Lemon John Lemon
See the line in red aboveI think you need some delimiter to separate between various items in Table2 for getting matches correctly------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs