"mean": 8}
}
}'::json->'ports'
))
) T
WHERE (value::json->>'mean')::float >= 7;
From: David Gauthier
Sent: Tuesday, November 30, 2021 9:40 PM
To: P
On Tue, Nov 30, 2021 at 1:40 PM David Gauthier
wrote:
> {
> ports : {
> port_abc:{min: 5, max: 7, mean: 6},
> port_def:{min: 5, max: 9, mean: 7},
> port_ghi:{min: 6, max: 10, mean: 8}
> }
> }
>
> select 1 from mytbl where cast(test_results#>'{ports,***,mean}' as float)
> >= 7 ;
>
PG 11.5 on linux
Let's say I store a jsonb in a column called test_results that looks like
this...
{
ports : {
port_abc:{min: 5, max: 7, mean: 6},
port_def:{min: 5, max: 9, mean: 7},
port_ghi:{min: 6, max: 10, mean: 8}
}
}
And I want to to get all the port names where the mean is