Query to search in JSON column

The promlem is to search in json column. Using MYSQL REGEXP is the solution:

SELECT * 
FROM  `orders` 
WHERE  `json` REGEXP  '(.*"op-number-29":"".*)'

If we want to get all rows where op-number-29 is not equel to “”:

SELECT * 
FROM  `orders` 
WHERE  `json` NOT REGEXP  '(.*"op-number-29":"".*)'

Leave a Reply

Your email address will not be published. Required fields are marked *