0

While using Json type in postgresql

data


{{"name":"Roy","Country":"USA","Hobby":"Swim"},{name:"Roy",Country:"USA","Hobby":"Crcket"},{"name":"Anam","country":"Greece","Hobby":"Polo"}}

how can i get all matching values with data->>name="Roy"?

O/P should be : {{"name":"Roy","Country":"USA","Hobby":"Swim"},{name:"Roy",Country:"USA","Hobby":"Crcket"}}

How can i query for such condition?

Mohit Gupta
  • 215
  • 5
  • 7
  • 1
    Cross post: http://dba.stackexchange.com/q/87493/1822 –  Jan 03 '15 at 17:17
  • We do not appreciate crossposts, especially without telling so. Even less questions that are missing most of the essential context: Postgres version, table definition, what you tried. For starters, your JSON value is ***invalid***, quotes are missing. You probably meant a JSON array with square brackets: `'[{"name":"Roy","Country":"USA","Hobby":"Swim"},{"name":"Roy","Country":"USA","Hobby":"Cricket"},{"name":"Anam","Country":"Greece","Hobby":"Polo"}]'::json` – Erwin Brandstetter Jan 04 '15 at 04:01

0 Answers0