问题描述 投票:0回答:1

create table test ( id int generated by default as identity primary key ,data json); Insert into test values ('{"description":"employee", "criteria": { "employee_id":{ "in":["10137","12137","19137"] } } }') returning jsonb_pretty(data);

下面是我用于那个的查询

select data from test where JSON_EXISTS( data, 'criteria'->'employee_id'->'strict $.in[*] ?@ (['1299','12137')' );

我认为您正在使用错误的方法

JSON_EXISTS

,请尝试以下一个:
select
    data
from test
where JSON_EXISTS(
    data::jsonb,  -- convert your data to jsonb first
    '$.criteria.employee_id.in'  -- corrected path of your expression
);

postgresql psql
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.