问题
Lets say I have a database A with tables B1 and B2. B1 has columns C1 and C2
and B2 has columns D1, D2 and D3.
I am looking for an Impala query that yields the following desired output:
B1 | "C1+C2"
B2 | "D1+D2+D3"
where "D1+D2+D3" and "C1+C2" are concatenated strings.
回答1:
Do you want the concatenated columns in a new table? Or do you want to add the concatenated columns to your existing tables? Either way, you can use the code below in impala to concatenated columns:
SELECT
CONCAT(C1,C2) AS concat_fields
, "B1" AS table_name
FROM B1
UNION
SELECT
CONCAT(D1,D2,D3) AS concat_fields
, "B2" AS table_name
FROM B2
来源:https://stackoverflow.com/questions/49321946/impala-get-for-all-tables-in-database-concentenated-columns