我有这个 mySQL 查询:
SELECT
CONCAT_WS('=>',column_1,column_2,column_3)
AS column_union
FROM table
其中结果是这 3 列的组合,并以 =>
作为分隔符。
是否可以在同一查询中将第一个串联的结果与任何其他列串联?
例如:
SELECT CONCAT_WS('#**#',column_4,column_5,column_union)
AS another_column_union
FROM table
最终结果another_column_union
应如下所示:
value_column_4#**#value_column_5#**#v1=>va=>v0
最佳答案
您需要使用 View 、子查询或重复表达式。也可以简化为:
SELECT concat_ws('=>', column_1, column_2, column_3) as column_union,
concat_ws('#**#', column_4, column_5,
concat_ws('=>', column_1, column_2, column_3)
) as another_column_union
FROM table
关于mysql - 连接mySQL中两个连接的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43999477/