bitsCN.com
mysql字符串截取命令
1. substring_index
substring_index(str,delim,count)
[html]
mysql> select substring_index('a-b-c-d','-',-1);
+-----------------------------------+
| substring_index('a-b-c-d','-',-1) |
+-----------------------------------+
| d |
+-----------------------------------+
1 row in set (0.00 sec)
mysql> select substring_index('a-b-c-d','-',1);
+----------------------------------+
| substring_index('a-b-c-d','-',1) |
+----------------------------------+
| a |
+----------------------------------+
1 row in set (0.00 sec)
2. SUBSTRING
SUBSTRING(str,pos,len)
SUBSTRING(str FROM pos FOR len)
SUBSTRING(str,pos)
SUBSTRING(str FROM pos)
[html]
mysql> select substring((substring_index('a-b-c-d','-',2)),2);
+-------------------------------------------------+
| substring((substring_index('a-b-c-d','-',2)),2) |
+-------------------------------------------------+
| -b |
+-------------------------------------------------+
1 row in set (0.01 sec)
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号