Answer the question
In order to leave comments, you need to log in
How to select by value from jsonb field?
There is a field in the table with the jsonb type, in it, respectively, the structure {key1:value, key2:value, etc.}
How to write the following queries?
Select table columns and values for field with key1
Select table columns where value key2 = given
Answer the question
In order to leave comments, you need to log in
select field1,
jsonb_field -> 'key' as jsonb_value
from mytable
where jsonb_field @> '{"key":"value"}'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question