我有两列要转换为varchars,然后连接起来放在一列中:
我该如何在Hive中做到这一点?当我在sql中尝试正常的方法时,我总是遇到问题……
round(min(temp) over (partition by temp2, temp3) min,
round(max(temp)) over (partition by temp2, temp3) max
*original columns*
min max
0 100
=====================================
*new column*
min-max
$0-$100
答案:
这对我很有效..。
concat('$',cast(round(min(temp)) as string), ' - $', cast(round(max(temp)) as string)) over (partition by temp2, temp3) newColumn
https://stackoverflow.com/questions/27252399
复制相似问题