Skip to content
Advertisement

Fetch data from database while comparing id with a column[type=jsonnb] having json data in Postgresql

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 @>:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement