我在表1中有类似date_column = 20140228的字段。当我对下面的数字进行硬编码时,它可以工作,但是当我指定列名时它失败了。有错误 H110无法提交声明。编译语句时出错:FAILED:ParseException第2:1行无法识别输入' select' ' DATE_FORMAT' '('在select子句[ERROR_STATUS]
中Working:
select date_format(from_unixtime(unix_timestamp(cast('2014022817' as string),'yyyyMMddHH')),'yyyy-MM-dd HH');
Failing:
select
select date_format(from_unixtime(unix_timestamp(cast(date_column as string),'yyyyMMddHH')),'yyyy-MM-dd HH')
from
table1
答案 0 :(得分:2)
为什么要重复select
?试试这个:
select date_format(from_unixtime(unix_timestamp(cast(date_column as string
),'yyyyMMddHH'
)
),'yyyy-MM-dd HH'
)
from table1