在 sql 中以管道分隔的列中的搜索值
我想搜索列中以管道分隔的值.见下文.
I want to search value which is pipe-separated in column. See below.
Column1
1
1|2|23
2
6
6|12
我想在所有行中搜索 2,这样它就会返回到行下方
I want to search 2 in all rows so it will return below rows
Column1
1|2|23
2
谁能告诉我我们怎样才能做到这一点?
Can anyone please tell me how can we achieve this?
推荐答案
你可以使用like
:
where '|'+column1+'|' like '%|2|%'
通过包含额外的分隔符,您可以避免2"匹配23".
By including the extra delimiters, you avoid having "2" match "23".
相关文章