I have a table that stores conditions
CREATE TABLE conditions (field_id TEXT, value BOOLEAN)
With entries like
field_id | value |
---|---|
f1 | true |
f2 | false |
And another table that stores users with field values in a jsonb column
CREATE TABLE users (id BIGINT, fields JSON)
With entries like
id | values |
---|---|
1 | {"f1":true, "f2":false} |
2 | {"f1":true, "f2":true} |
3 | {"f1":false, "f2":false} |
I'd like to write a query that returns only the user with 1 in my example.