Compare Columns Where One is Similar to Part of Another

后端 未结 7 1371
再見小時候
再見小時候 2020-12-05 07:35

I\'m trying to write a Select statement where I can see if one column is like part of another.

tblNames 
ID    FullName                   FirstName
1     Mr.         


        
7条回答
  •  温柔的废话
    2020-12-05 08:08

    Switch the arguments to LIKE in the WHERE clause:

    SELECT ID, FullName, FirstName
    FROM tblNames
    WHERE Fullname not like '%' + FirstName + '%'
    

    The wildcard must be the second argument.

提交回复
热议问题