Impala月名称功能

问题描述 投票:-1回答:2

我们可以将月份数字转换为月份名称。我可以看到一个名为月份名称的函数

https://impala.apache.org/docs/build/html/topics/impala_datetime_functions.html#datetime_functions__month

但是它不起作用。

sql impala sql-date-functions
2个回答
0
投票

您可以转换为Unix时间戳并使用:

from_unixtime(col, 'MMM')

0
投票

您应该使用日期字段来获取月份名称,但是如果您坚持使用月份号列,则可以使用decode。也可以使用case语句来表达]

select decode(month_number, 1, "Jan", 2, "Feb", 3, "Mar".....) as month_name
from your_table;
© www.soinside.com 2019 - 2024. All rights reserved.