我正在寻找一个更新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:“en_US”; s:11:“Donau river”;}
到
多瑙河
使用这个新值同时更新mysql字段?
答案 0 :(得分:1)
试试这个
UPDATE yourTable
SET title = SUBSTRING_INDEX(SUBSTRING_INDEX(title,'";}',1),':"',-1);