I tried to use JSON_VALUE within GROUP_BY clause and got this error:
JSON text is not properly formatted. Unexpected character 'b' is found at position 0.
When I use it only in SELECT, I get the expected result.
SELECT
COUNT(*),
Date,
JSON_VALUE(msg, '$.a')
FROM
requests
GROUP BY
Date, JSON_VALUE(msg, '$.a')
It seems, that there is an invalid JSON, stored in the
msgcolumn. But you may try to change your statement.Table:
Statement:
Result:
As an additional note, if you want to get the rows with the invalid JSON content, execute the following statement: