跳转至

Concat

概述

Concat 函数用于将两个或多个字符串连接成一个字符串。

语法说明

Concat(<字符串1>, <字符串2>, [<字符串3>, ...])

参数说明

参数 必需 参数类型 说明
字符串1 字段、表达式、常量 第一个需要连接的字符串
字符串2 字段、表达式、常量 第二个需要连接的字符串
字符串3, ... 字段、表达式、常量 其他需要连接的字符串(可选)

示例

示例:连接产品名称和产品代码

假设在一个产品数据表中,产品名称存储在名为 ProductName 的字段中,产品代码存储在名为 ProductCode 的字段中。我们希望将产品名称和产品代码连接成一个字符串,可以使用如下表达式:

公式示例

Concat(ProductName, " - ", ProductCode)

数据示例

ProductID ProductName ProductCode
P001 "iPhone 13" "A123"
P002 "Galaxy S21" "B456"
P003 "Pixel 5" "C789"
P004 "Surface Pro 7" "D012"
P005 "PlayStation 5" "E345"

计算结果

通过上述 Concat 函数表达式,结果将会是:

ProductID ProductName ProductCode CombinedString
P001 "iPhone 13" "A123" "iPhone 13 - A123"
P002 "Galaxy S21" "B456" "Galaxy S21 - B456"
P003 "Pixel 5" "C789" "Pixel 5 - C789"
P004 "Surface Pro 7" "D012" "Surface Pro 7 - D012"
P005 "PlayStation 5" "E345" "PlayStation 5 - E345"

Concat(ProductName, " - ", ProductCode) 将 ProductName 字段与 ProductCode 字段连接在一起,中间用 " - " 分隔。