Skip to content
Advertisement

Tag: json

SQL get the value of a nested key in a jsonb field

Let’s suppose I have a table my_table with a field named data, of type jsonb, which thus contains a json data structure. let’s suppose that if I run I get so in pretty formatting, the content of column data is I know that If I want to get directly in a column the value of a key (of “level 1”)

SQL Group by JSON arrays

So I have a JSON variable (var2), which is an array. I have the following data: I’m trying to write a query that gives back the number of dollars and the machines per group: Example: I’m not used to JSON arrays and it’s kinda tricky for me. I’ve tried many things and I can’t find much documentation with examples for

PostgreSQL – Adding up json values

This is my json column in pgSQL and I need to add up all of the “sum” amounts using pgSQL. So the query should return “50” using the data below. I did find something like this (Get aggregate sum of json array in Postgres NOSQL json data) that kinda works if I had my values in array, but I dont,

Advertisement