amazon-web-services - 如何在 Amazon Athena 中获取数据中的左十个字符
问题描述
我正在尝试创建一个包含日期最左边 10 个字符的视图,因为我不需要小时、分钟、秒。
我试过左边的查询,但说不支持这种查询。
CREATE OR REPLACE VIEW generated_date AS SELECT left("generation_date", 10) FROM database_final
我预计 2019/02/08 但它最初是 2019/02/08 12:00:00
解决方案
SUBSTR("generation_date", 1, 10)
将为您提供字符串的前 10 个字符。
您可以在此处找到 Athena 支持的所有字符串函数:https ://prestodb.github.io/docs/0.172/functions/string.html
推荐阅读
- javafx - 在 ArcGIS 中将给定的几何图形转换为 PointCollection
- c# - Photon Bolt:跨网络的网络 ID 不一致
- r - 如何在ggplot2中按多个变量分组
- .net - Ignite 服务器停止响应许多“无法向远程节点发送消息”
- c# - 在 Xml 反序列化期间,矩阵返回 null
- docker - docker中的nextcloudpi:无法使用已安装的外部存储
- angular - “AngularFireAuth”类型上不存在属性“auth”
- android - Camera2 SENSOR_INFO_SENSITIVITY_RANGE 特定分辨率/模式的值
- quarkus - 在我的 junit 中运行 Kogito DMN TrafficViolationTest 的问题
- python - 使用 pandas 读取 csv 文件时如何转换数据类型?