我相信这是一个重复的问题,因为答案在某个地方已经存在,但是在谷歌搜索了10分钟后,我还是没有找到答案,所以我要求编辑们不要基于这个问题可能对其他人有用而关闭它。
我正在使用Postgres 9.5。这是我的表格:
我想找到所有在
我已经找到了文档并进行了谷歌搜索,这是我尝试过的方法:
我已经浏览了the postgres array docs,但没有看到一个简单的运行查询的例子,而且StackOverflow上的问题似乎都是基于更复杂的例子。
我正在使用Postgres 9.5。这是我的表格:
Column │ Type │ Modifiers
────────────────────────┼───────────────────────────┼─────────────────────────────────────────────────────────────────────────
id │ integer │ not null default nextval('mytable_id_seq'::regclass)
pmid │ character varying(200) │
pub_types │ character varying(2000)[] │ not null
我想找到所有在
pub_types
中含有"Journal"的行。我已经找到了文档并进行了谷歌搜索,这是我尝试过的方法:
select * from mytable where ("Journal") IN pub_types;
select * from mytable where "Journal" IN pub_types;
select * from mytable where pub_types=ANY("Journal");
select * from mytable where pub_types IN ("Journal");
select * from mytable where where pub_types contains "Journal";
我已经浏览了the postgres array docs,但没有看到一个简单的运行查询的例子,而且StackOverflow上的问题似乎都是基于更复杂的例子。