I currently have a MySQL table that contains a column to store category ids. These ids are stored in a JSON string. I am looking for the most efficient method to query these JSON string for a specific id.
For example:
Table: posts
Field: cats
Here are some example values for the JSON string in the cats column:
[111, 123, 456]
[123, 345, 999]
[555, 777, 888]
Let's say I want to query for all rows that contain the id: "123" within the JSON string. I know I can accomplish this using a series of LIKE comparisons but I'm sure there is a more efficient way to query the JSON strings. Any other ideas would be much appreciated.
Thanks!