减法天数(黑斑羚)
您能告诉我如何显示“日期”减去今天日期两天的行吗?以及如何更改字符串的数据类型。 “日期”列采用 YYYYMMDD 格式。
为什么这个查询不起作用?
select * from table where 'date'= cast(subdate(current_date(), 2 days) as string)
Can you please tell me how to display lines where 'date' minus two days from today's date. And how then to change the data type of string. The 'date' column is in YYYYMMDD format.
Why is this query not working?
select * from table where 'date'= cast(subdate(current_date(), 2 days) as string)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用下面的
from_timestamp(timestamp_data, 'yyyyMMdd')
- 这会将日期转换为所需的字符串格式。-interval 2 days
- 这会将日期时间恢复到系统日期之前的 2 天。use below
from_timestamp(timestamp_data, 'yyyyMMdd')
- This converts a date to a desired string format.-interval 2 days
- This takes date time back to 2days before system date.