For my data on S3, I have defined a table in AWS Glue Data Catalog. This table contains two columns of Timestamp
type. I want to subtract these two columns and show it as different column. I have tried the following query
SELECT outtime, intime, outtime-intime AS length
FROM database.table
LIMIT 10
However, it gives me the following error.
SYNTAX_ERROR: line 1:66: '-' cannot be applied to timestamp, timestamp
How can I solve this problem? I am using Athena to query data in my S3.
You can use date_diff()
, such as:
date_diff(second, intime, outtime)
This returns the result in seconds.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.