I'm using MySQL 5.5.37. I have a TEXT column that contains values resembling ...
... "id":"51b21a0710340adf6501db67"}},"created":"2014-08-22T15:42:57.969Z","id":"53f76502f82c7abf3d01fba5"},"uri":"/v1.1/events/53f76502f82c7abf3d01fba5"}
What I'm trying to figure out is how to extract the 32-character value immediately after the second to last '"id":' string (without the quotes surrounding the 32 character item). What is the easiest way to do this in MySQL?
You can use SUBSTRING_INDEX
to find the second to last occurrence, and use LEFT
to cut out the first 32 characters that follow (although I suspect you only want 24);
SELECT LEFT(SUBSTRING_INDEX(value, '"id":"', -2), 32) FROM bop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.