Gop*_*h.R 9 sql postgresql select contains where-clause
postgres中有功能contains吗?可用于where clause检查,传递的字符串是否包含在列中?
NPE*_*NPE 17
你可以用position()它.如果未找到子字符串,则返回零:
position(col2 in col1) <> 0
Run Code Online (Sandbox Code Playgroud)
有很多方法可以解决这个问题:
使用like,, ilike和/或SIMILAR TO与||一起使用.要处理列,例如:
WHERE col1 ilike '%' || col2 || '%';
Run Code Online (Sandbox Code Playgroud)使用位置作为NPE的答案
你也可以使用,regexp_matches但这更复杂.