*left(), right(), substring(), substring_index(),mid(), substr(),mid(), substr() 等价于 substring() 函数
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);
_________
时间: 2024-10-10 00:25:01