I have these records in a MySQL DB. On a JSON type column.
Record1: {"images": ["image.jpeg", "image.jpeg"]}
Record2: {"images": ["image.jpeg", "image.jpeg", "image.jpeg"]}
Record3: {"images": ["image.jpeg"]}
How can I get the total count of images by the key name of the JSON property which in my case is 'images'?
I am trying to achieve the same thing as running this below query, but counting the array items from the images key.
SELECT
`field`,
count( * ) AS total
FROM
`table_name`
WHERE
`condition`
GROUP BY
`something`
which will give you this result:
field total
------------------
field1 5
field2 2
What I am trying to achieve:
field total
-----------------
images 6

