表结构如下:-
mysql> select * from formjson;
+----+---------------------------------------------------------+
| id | jsonData |
+----+---------------------------------------------------------+
| 1 | {"721005":"NO","720931":"1156","720940":"aegiseng",} |
| 2 | {"721005":"NO","720931":"1156","720940":"aegiseng",} |
| 3 | {"721005":"NO","720931":"50253","720940":"d1-gateway",} |
| 4 | {"721005":"NO","720931":"11102","720940":"uxinfra",} |
| 5 | {"720931":"1152","720940":"zappops-notify",} |
+----+---------------------------------------------------------+
5 rows in set (0.00 sec)
我想删除jsondata中最后出现的逗号,即“,}”到“}”
我试过了
mysql> update formjson set jsonData=CONCAT(TRIM(TRAILING ',}' FROM jsonData),'}') where jsonData like '%,}';
上面是工作。
但是在mysql中有没有其他方法可以做到这一点,比如使用regexp用户定义函数等?
1条答案
按热度按时间bf1o4zei1#
请尝试: