简体   繁体   English

如何在 BigQuery 中使用 CONCAT 和 +

[英]How to use CONCAT with + in BigQuery

I tried using CONCAT with + sign in SQL, however I am not getting the correct syntax to perform this query.我尝试在 SQL 中使用带有 + 号的 CONCAT,但是我没有得到正确的语法来执行此查询。 The tool that I am using is Google BigQuery.我使用的工具是 Google BigQuery。

To concatenate strings in BigQuery, we can either use the CONCAT() function, or we can use the ||要在 BigQuery 中连接字符串,我们可以使用CONCAT() function,也可以使用|| ANSI concatenation operator: ANSI 连接运算符:

SELECT CONCAT('Hello', 'World')
SELECT 'Hello' || 'World'

Other databases such as SQL Server use the + operator for string concatenation, but not BigQuery.其他数据库(例如 SQL 服务器)使用+运算符进行字符串连接,但不使用 BigQuery。

One more option:o)另一种选择:o)

SELECT FORMAT('%s %s', 'Hello', 'World')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM