【发布时间】:2019-06-19 00:31:44
【问题描述】:
我正在处理 Symfony“工作流程”“标记”和 Postgres。 (和教义)
在数据库中,“状态”列包含这样的 JSON 数据
{"needs_address":1,"needs_contacts":1,"needs_education":1,"needs_health_and_social":1,"has_profile_photo":1,"has_letter":1}
我想出了如何像这样查询
SELECT id, profile_status, beneficiary_code
FROM public.beneficiary_profile
WHERE profile_status->>'needs_address' = '1'
如何查询状态列表'like('needs_education','needs_contacts','needs_address')
不用像
WHERE profile_status->>'needs_address' = '1'
OR profile_status->>'needs_contacts' = '1'
OR profile_status->>'needs_education' = '1'
我认为必须有一种 JSON 函数的方法,可能是 IN() 或 ANY()
【问题讨论】:
标签: json postgresql symfony doctrine-query