UPDATE url_copy
SET url = SUBSTRING(
SUBSTRING(content, POSITION('http://' IN content)),
1,
POSITION(' ' IN CONCAT(SUBSTRING(content, POSITION('http://' IN content)), ' ')) -1
);
我测试的数据:
SELECT * FROM url_copy;
+-------------------------------------------------------------+--------------------------------+
| content | url |
+-------------------------------------------------------------+--------------------------------+
| this is content and http://facebook.com/puggan.se is my url | http://facebook.com/puggan.se |
| http://puggan.se/ | http://puggan.se/ |
+-------------------------------------------------------------+--------------------------------+
2 rows in set (0.00 sec)