SQL search column where one item in column is substring of another item

前端 未结 3 1656
终归单人心
终归单人心 2021-01-16 09:16

Is there a way to for an sql statement to search if a column string with multiple items contains a certain item, but not include a certain item that is a substring. The fol

3条回答
  •  渐次进展
    2021-01-16 10:11

    I would do something like this:

    select *
    from tbltest
    where platform like '%item%'
    and platform not like '%item.%' -- searching for ASP
    and platform not like '%.item%' -- searching for NET
    

    Notice the additional dot before and after item.

提交回复
热议问题