Im trying to add a date difference calculation to a Redshift SQL query:
SELECT
client,
session,
person_id,
min(event_start) as "session_start",
max(event_finish) as "session_finish",
sum (case when event_type = 'execute-query-action-1' then 1 else 0 end) as "Type1 reports run" ,
sum (case when event_type = 'execute-query-action-2' then 1 else 0 end) as "Type 2 reports run" ,
DATEDIFF(MINUTE,session_start,session_finish) as "session_duration_minutes"
FROM usage_log
group by client,person_Id,session
... and I'm getting an error:
function pg_catalog.date_diff("unknown", timestamp with time zone, timestamp with time zone) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts.
Any suggestions?