- 1. 字符串截取:left(str, length)
- mysql> select left('example.com', 3);
- +-------------------------+
- | left('example.com', 3) |
- +-------------------------+
- | exa |
- +-------------------------+
- 2. 字符串截取:right(str, length)
- mysql> select right('example.com', 3);
- +--------------------------+
- | right('example.com', 3) |
- +--------------------------+
- | com |
- +--------------------------+//从一个字段取后两位字符更新到另外一个字段update `historydata` set `last2`=right(last3, 2);
来源: http://www.bubuko.com/infodetail-2025609.html