[英]How to query array which is present as string in postgres?
I have a table called table
with column called column
with datatype text
with values like ' ["1","2"]
'.我有一个名为table
的表,其列名为column
,其数据类型为text
,其值类似于' ["1","2"]
'。
I need to get all records which has "1" as one of the element.我需要获取所有以“1”作为元素之一的记录。
select *
from table
where column.....?
How should the where clause be? where子句应该怎么写?
Simply use LIKE
.只需使用LIKE
。 Keep the double quotes to pass 1, but avoid other numbers containing that digit.保留双引号以传递 1,但避免包含该数字的其他数字。
select *
from table
where column like '%"1"%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.