Table has two columns: id and data.
Column data has type jsonb
json :
"weight": {
"qty": 300,
"unit": {
"name": "gram",
"title": {
"en": "g"
}
}
I want to filter by json's nodes weight and qty.
Here query:
SELECT
(product.data #>'{weight,qty}') AS weight
FROM product
WHERE weight = 300
order by id desc
But I get error:
ERROR: column "weight" does not exist
LINE 4: WHERE weight = 123
^
SQL state: 42703
Character: 70