我试图显示 "empdate "列和当前日期之间的天数差小于等于365的记录。
列empdate是varchar数据类型.我已经写了下面的查询,但不能实现结果。其中我得到的所有记录是大于365的当前日期和empdate之间。
select * from table where
cast(datediff(from_unixtime(unix_timestamp(current_date 'yyyy-MM-dd'),'yy-MM-dd'),
from_unixtime(unix_timestamp(cast(empdate as string)'yyMMdd'),'yy-MM-dd') as int)<=365;
1条答案
按热度按时间syqv5f0l1#
下面的查询可能对你有所帮助。
测试来自hive的查询。