JSON_EXTRACT on array of objects in MYSQL

1.6k Views Asked by At

How to search in array of objects in mysql using JSON_EXTRACT ?

Here is the data json

[
  {
    "prd_type": "stand_alone",
    "prd_unitprice": 70
  },
  {
  
    "prd_type": "stand_alone",
    "prd_unitprice": 50,
  }
]

and here is my query, this query works if there is only one object in array, it ignores second object in search

 SELECT  id,order_detail
     FROM member_transactions WHERE JSON_EXTRACT(order_detail, "$[*].prd_unitprice") < JSON_ARRAY(60);

the above query will not fetch record from second object of array

0

There are 0 best solutions below