'Best way to check if query mysql table with JSON column if equals a JSON value?
Hi I have a mysql table with a JSON column. Lets say table name is example_table and JSON column name is json_column and I have a JSON value x that I want to query by.
I was wondering if there is someway to query on the table to see if a value inside example_table that has a json_column value equal to x.
So something like this:
select * from example_table where json_column=x;
Example where x is a JSON array.select * from example_table where json_column='["12345", "56789"]';
The above query does not work. I was wondering how I can query the table this way?
Solution 1:[1]
I figured it out.
select * from example_table where json_column=CAST('["12345", "56789"]' AS JSON);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jayleen |
