I have a column called vendor
having jsonnb type and a json data like [{"id":"1","name":"Dev"}]
I wanted to select row data puting this column in where clause like WHERE vendor.id=1
So how can i do that, any help will be appriciated
Advertisement
Answer
You can use the contains operator @>
:
select * from the_table where vendor @> '[{"id":"1"}]'::jsonb;