I am trying to get all records that contain WEAPON_COMBATPISTOL in the column inventory within my users table.
It is based on JSON. I am lost I have tried JSON_EXTRACT & JSON_CONTAINS.
JSON DATA:
[{"slot":1,"count":450,"name":"money"},
{"slot":2,"count":54,"name":"ammo-9"},
{"metadata":{"serial":"643280CXJ213639","durability":97.91999999999998,"registered":"Barry McCeiner","components":[],"ammo":11},"slot":3,"count":1,"name":"WEAPON_COMBATPISTOL"},
{"slot":4,"count":8,"name":"burger"},
{"slot":5,"count":8,"name":"icetea"},
{"slot":6,"count":7,"name":"stone"},
{"slot":10,"count":6,"name":"lockpick"}]
SQL Statement:
SELECT * FROM users WHERE JSON_CONTAINS(inventory, 'WEAPON_COMBATPISTOL', '$.name');
I also want to remove just the WEAPON_COMBATPISTOL from the JSON data. If that is possible.