[英]Search PostgreSQL column for substring
I have a DB column that has entries like this: 我有一个包含以下条目的数据库列:
I want to search for the rows that match a certain number - for example "45" would should return the first and third rows but not the second. 我想搜索与某个数字匹配的行-例如,“ 45”应返回第一行和第三行,而不返回第二行。
You can convert the delimited string to an array and then test the array 您可以将定界字符串转换为数组,然后测试该数组
select *
from the_table
where '45' = any(string_to_array(the_column, '/'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.