我有一个名为 table
的表,其中包含名为 column
的列,数据类型为 text
,其值类似于 '["1","2"]
'.
我需要获取所有以“1”作为元素之一的记录。
select *
from table
where column.....?
where子句应该怎么写?
最佳答案
只需使用LIKE
。保留双引号以传递 1,但避免包含该数字的其他数字。
select *
from table
where column like '%"1"%'
关于sql - 如何查询在 postgres 中以字符串形式存在的数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58008972/