连接HANA数据库中的两列

时间:2015-10-09 11:34:11

标签: sql-server hana

请给我一个建议,将MSSQL VIEW转换为HANA VIEW

CREATE VIEW [dbo].[ViewSample]
AS
SELECT [column1] + ' / ' + [cloumn2] AS CollectionLabel
FROM [dbo].[T1] T1
CROSS JOIN [dbo].[T2] T2

提前致谢

3 个答案:

答案 0 :(得分:4)

还有一个concat运算符,允许你这样做(||)

CREATE VIEW "dbo"."ViewSample"
    AS
    SELECT "column1" || ' / ' || "cloumn2" AS CollectionLabel
    FROM "dbo"."T1" T1
    CROSS JOIN "dbo"."T2" T2

答案 1 :(得分:2)

CONCAT两次怎么样?

CREATE VIEW "dbo"."ViewSample"
    AS
    SELECT CONCAT("column1", CONCAT(' / ', "cloumn2")) AS CollectionLabel
    FROM "dbo"."T1" T1
    CROSS JOIN "dbo"."T2" T2

答案 2 :(得分:2)

只需使用'||'连接字符串和列。

假设您需要一个人的全名,并且在您的表中有两列,即NAME和LAST_NAME。

SELECT NAME||' '||LAST_NAME FROM myTable