Reputation: 1648
I'm trying to construct a MySQL query that would do the following:
Sample Data:
---------------------------------------------
| colm |
---------------------------------------------
|{"level":10, "something": "blah", etc} |
---------------------------------------------
|{"level":3, "something": "blah", etc} |
---------------------------------------------
|{"level":7, "something": "blah", etc} |
---------------------------------------------
|{"level":21, "something": "blah", etc} |
I need to SELECT
rows where colm LIKE "%?%"
with the ?
being level is less than or equal to (<=
) some value. For example, SELECT
ing all rows where colm
has the JSON string's level
key-pair value <= 8
, getting the middle two rows.
How can I do this? I'm thinking something with JSON functions instead of using LIKE
and %
wildcards, but I'm not sure exactly what I need to do.
Upvotes: 0
Views: 50