我正在寻找一个选项来更新mysql表中的现有字段,其中标题说
+---------------------------------------------------------------------+---------+
| title | albumid |
+---------------------------------------------------------------------+---------|
| a:1:{s:5:"en_US";s:11:"Donau river";} | 171 |
| a:1:{s:5:"en_US";s:26:"The Sunset of River Danube";} | 171 |
| a:1:{s:5:"en_US";s:26:"quiet evening at the river";} | 171 |
| a:1:{s:5:"en_US";s:20:"river beach interior";} | 171 |
| a:1:{s:5:"en_US";s:41:"A quiet evening on the beach at the river";} | 171 |
想要修剪标题字段,例如
从
a:1:{s:5:“ zh_CN”; s:11:“多瑙河”;}
至
多瑙河
并使用此新值同时更新mysql字段?
最佳答案
尝试这个
UPDATE yourTable
SET title = SUBSTRING_INDEX(SUBSTRING_INDEX(title,'";}',1),':"',-1);