How to check if string value in one column is partially contained in string value of another column using SQL?

后端 未结 1 1100
执念已碎
执念已碎 2021-01-28 00:45

How do I check if string value in one column is partially contained in string value of another column using SQL?

If I had to check if col_1 column of tbl table contains

相关标签:
1条回答
  • 2021-01-28 01:14
    SELECT * FROM tbl WHERE col_1 LIKE '%'+col_2+'%'
    

    EDIT: For MySQL, the equivalent syntax would be:

    SELECT * FROM tbl WHERE col_1 LIKE CONCAT('%',col_2,'%')
    
    0 讨论(0)
提交回复
热议问题