Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

Is it possible to select distinct values in a json document using PostgreSQL?

$
0
0

I have a column that is using the JSON type. I would like to perform a query to select all distinct records for a particular field in the JSON string: I.e. given these three documents

{
  id: 1,
  s: "foo"
},
{
  id:2,
  s: "bar"
},
{
  id:3,
  s: "foo"
},

the query must check the “s” key for distinct values and return the documents with id 1 and 2.


Viewing all articles
Browse latest Browse all 148

Trending Articles