SQL SUBSTR 函数:截取字符串的用法示例
这个 SQL 语句表示从 'a' 表的 'bed_no' 字段的第 5 个字符开始,截取 4 个字符的子字符串。
SUBSTR(a.bed_no, 5, 4)
SUBSTR 函数语法:
SUBSTR(string, start_position, length)
- string: 要截取的字符串
- start_position: 开始截取的位置,从 1 开始计数
- length: 截取的字符长度
示例:
假设 'bed_no' 字段包含的值为 '12345678',那么 SUBSTR(a.bed_no, 5, 4) 将返回 '5678'。
原文地址: http://www.cveoy.top/t/topic/oUGw 著作权归作者所有。请勿转载和采集!