Filter rows of one table with conditions coming from another table
1
vote
2
answers
858
views
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.
Asked by mravey
(113 rep)
Jul 6, 2022, 10:16 PM
Last activity: Jul 9, 2022, 10:28 PM
Last activity: Jul 9, 2022, 10:28 PM