Mysql table JSON field, I want to query the costCenterId of the objects in the products array in this field is equal to a value, how to write path?

clipboard.png
productspath
:

clipboard.png

content:

clipboard.png

Jul.06,2021

solution
1. If you have administrator privileges, it is recommended that you upgrade to mysql5.7,. This is the best way to query the array in json
2. Use mysql function, if like (hit rate is low), use regular REGEXP, to take the last sentence of your screenshot sql as an example

AND content REGEXP '{costCenterId:".*"}' // 

after research, I have found a solution, which is as follows:

clipboard.png

sql


clipboard.png
is there illegal content in my field, or is there a limit to using this?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dfd0-2bc24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dfd0-2bc24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?