I've got jsonb field in my database table (a_table) with int value within, say:
{
"abc":{
"def":{
"ghk":500
}
}
}
I'm about to create SELECT with filter by this field ("ghk") using WHERE clause:
SELECT * FROM a_table WHERE ghk BETWEEN 0 AND 1000;
How should i create such a query? Couldn't find good tutorial for jsonb usage so far.
Thanks in advance!
EDIT
I found this solution:
SELECT * FROM a_table WHERE a_field #> '{abc,def,ghk}' BETWEEN '0' AND '10000' ;
Is it correct?