แก้ไข

แชร์ผ่าน


CONCAT (NoSQL query)

APPLIES TO: NoSQL

Returns a string that is the result of concatenating two or more string values.

Syntax

CONCAT(<string_expr_1>, <string_expr_2> [, <string_expr_N>])  

Arguments

Description
string_expr_1 The first string expression in the list.
string_expr_2 The second string expression in the list.
string_expr_N (Optional) Optional string expression[s], which can contain a variable number of expressions up to the Nth item in the list.

Note

The CONCAT function requires at least two string expression arguments.

Return types

Returns a string expression.

Examples

This first example returns the concatenated string of two string expressions.

SELECT VALUE
    CONCAT("adventure", "works")
[
  "adventureworks"
]

This next example uses an existing item in a container with various relevant fields.

[
  {
    "slug": "duonovi-pro-coat",
    "model": "8061",
    "category": "heavy-coats"
  }
]

This example uses the function to select two expressions from the item.

SELECT VALUE {
    sku: CONCAT(p.slug, "-", p.category, "-", p.model)
}
FROM
    products p
WHERE
    p.category = "heavy-coats"
[
  {
    "sku": "duonovi-pro-coat-heavy-coats-8061"
  }
]

Remarks

  • This function doesn't use the index.