Find specific string from json array in SELECT [du

2019-06-13 18:17发布

问题:

This question already has an answer here:

  • How to search JSON array in MySQL? 5 answers
  • Mysql query WHERE column is in json array 2 answers

I am storing a list of IDs in my MYSQL database like so;

["269912219695710208","303225738340073472","280481820422963202","213478761432088586"]

and I want to search for a specific ID without having to pull the IDs then loop through them. Does anyone know of a neat MYSQL query line to do this?

The two linked provided as a possible duplicate do not help at all, and do not provide a clear answer.

I tried to do

SELECT * FROM clans WHERE JSON_SEARCH('clanMembers', 'one', '${msg.author.id}')

However nothing is ever returned and it does not seem to work...