0

表有两列:iddata

数据的类型为jsonb

json:

  "weight": {
    "qty": 300,
    "unit": {
      "name": "gram",
      "title": {
        "en": "g"
      }
    }
  

我想按 json 的节点weightqty过滤。

这里查询:

SELECT
(product.data #>'{weight,qty}') AS weight
FROM product 
WHERE weight = 300
order by id desc

但我得到错误:

ERROR:  column "weight" does not exist
LINE 4: WHERE weight = 123
              ^
SQL state: 42703
Character: 70
4

0 回答 0