I am Amazon Redshift. I tried to calculate the time difference between two time stamp columns in minutes, but the timestampdiff
function does not work on it. The error is telling me that minute
column does not exist in the table I query. At the same time some answers suggest that timestampdiff
does not work for PostgreSQL, but function like date_part
does not work on my end as well. Could anyone share experience or any document for the grammar and function on Amazon Redshift?
select
email,
createddate,
lastloggedin,
timestampdiff(minute, createddate, lastloggedin)
from udb.user
where createddate >= '2019-09-01' and createddate <= '2019-09-30'
Error: [Amazon](500310) Invalid operation: column "minute" does not exist in user; [SQL State=42703, DB Errorcode=500310] 1 statement failed.
Best Answer
Checking the docs for Amazon Redshift shows this:
So, your query should be: