Impala SQL将所有大于日期 - 日期列的所有记录分配为毫秒
I'm looking to retrieve all rows in a table where last_modified_date
is within the last 30 days. The date field is int and appears to be in milliseconds so not sure about the where condition. So a few steps here, convert the date field to standard date time then apply a date.或者,花时间并将所有记录取回30天。
SELECT last_modified_date,
from_timestamp(CAST(CAST(last_modified_date as decimal(30,0))/1000 AS timestamp), "yyyy-MM-dd HH:mm:ss.SSS") as "Completed_Date"
FROM helix_access.chg_infrastructure_change limit 100;
我尝试了一个基本条件,但没有返回任何内容:
select from_timestamp(CAST(CAST(last_modified_date as decimal(30,0))/1000 AS timestamp), "yyyy-MM-dd HH:mm:ss.SSS") as "Completed_Date"
from helix_access.chg_infrastructure_change limit 100;
where (Completed_Date) >= 2022-05-09 00:00:00.000
I'm looking to retrieve all rows in a table where last_modified_date
is within the last 30 days. The date field is int and appears to be in milliseconds so not sure about the where condition. So a few steps here, convert the date field to standard date time then apply a date. Alternatively take the current time and get all records back 30 days.
SELECT last_modified_date,
from_timestamp(CAST(CAST(last_modified_date as decimal(30,0))/1000 AS timestamp), "yyyy-MM-dd HH:mm:ss.SSS") as "Completed_Date"
FROM helix_access.chg_infrastructure_change limit 100;
I tried a basic where condition but it's not returning anything:
select from_timestamp(CAST(CAST(last_modified_date as decimal(30,0))/1000 AS timestamp), "yyyy-MM-dd HH:mm:ss.SSS") as "Completed_Date"
from helix_access.chg_infrastructure_change limit 100;
where (Completed_Date) >= 2022-05-09 00:00:00.000
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试此查询:
Try this query: