I have the following code
Sel account,Div,Modl,Sub_modlFrom table_1
Where Div
gives me 01
, Modl = 1
is CS
, and Sub_modl=1
.I should combine these fields to have:
01_CS_0101
Where the first 01
comes from Div
, CS
comes from Modl
, and the last 1
in 0101
comes from Sub_modl
. How could I get this result using concat function in teradata?
Best Answer
You can use concat
select account,concat(Div, '_', Modl, '_', '010', Sub_modl) as colNamefrom table_1
or you can use ||
select account,(Div || '_' || Modl || '_' || '010' || Sub_modl) as colNamefrom table_1