【发布时间】:2021-06-18 04:57:05
【问题描述】:
我有一个skillSets 表,其中包含以下字段。
skillSets
-------------------------
userId -> multiple rows for same users
data: JSON {
skillId
}
type
clientId
我想要传递数组中所有技能的所有用户。
所以如果一个用户有skills a, b and not c it should be ignored for skills in (a, b, c)。
但它应该选择用户which have skills a, b, c for skills in (a b, c)
还应该选择用户which have skills a, b, c, d for skills in (a, b, c)
Select userid, data, type
from g.skillSets where
clientid='cce2032a-fd3d-48a1-8e4c-417eb77776c3'
and type = 'Skill Item'
AND JSONB_EXTRACT_PATH_TEXT(g.skillSets.data,'skillId') in ('72c28245-968f-11eb-b30a-87bc1ba467bd','84737607-968f-11eb-b30a-87bc1ba467bd','cca8631f-968f-11eb-b30a-87bc1ba467bd');
【问题讨论】:
标签: sql postgresql relational-division