Let me explain . I have a json data set with values something like this:
"clientRequest": {
"uri": "/flow.php?id=FS-6097&utm_source=facebook&utm_medium=cpc&utm_term=cold",
"body": null,
"bytes": 608,
"flags": 1,
"referer": "http://m.facebook.com/",
"httpMethod": "GET",
"httpProtocol": "HTTP/1.1"
},
Now i want to create a Virtual column which only fetch value "FS-6097" from "clientRequest.uri". So a new column which just contains "FS-6097", not just whole uri.
I am already creating a virtual column for whole uri like below, which is fine.
ALTER TABLE `table_xyz_json`
ADD `url` TEXT
GENERATED ALWAYS AS (JSON_UNQUOTE(
JSON_EXTRACT(json_data, '$.clientRequest.uri')
))
VIRTUAL NULL;
any help would be highly appreciated .