Link to home
Create AccountLog in
Avatar of Sam OZ
Sam OZFlag for Australia

asked on

sql server search a table field like another table field

I have two sql server 2016 tables Table1 , Table2   with a fled myName in both filed
How can have a query that looks a table1 myname like table2 myname
I tried table1.myName like '%'  ||  table2.myName || '%'    but that seems to be not correct
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SQL Server uses + rather than || to do concatenation.  This is throughout T-SQL.  || has no meaning to SQL Server.