我有3列名为:
我想生成一个查询,它会给我输出:
呼叫调度时间 - 呼叫接收时间
呼叫清除时间 - 呼叫调度时间
如何在Hive查询语言中执行此操作?
答案 0 :(得分:0)
使用unix_timestamp()
将时间戳转换为秒,然后减去,如果你想在几分钟内得到结果,则除以60:
select (unix_timestamp(call_dispatch_time) - unix_timestamp(call_received_time))/60 as diff_received,
(unix_timestamp(call_cleared_time) - unix_timestamp(call_dispatch_time))/60 as diff_cleared
如果您想要秒数结果,请删除/60