I want to write this type query :
SELECT
CASE
WHEN t1.date_closed - t1.created_date < t3.estimated_solution_time_minutes THEN 'не в SL'
ELSE 'в SL'
END AS result
but t1.date_closed and t1.created_date are intervals like this ‘2023-05-02 11:30’,
but t3.estimated_solution_time_minutes is integer and i get error: ERROR: operator does not exist: interval < integer
how can i cast these intervals to integer
2
Answers
Yu can use this syntax for changing types
the second way is
The problem is not the CAST. In this case, you probably want
EXTRACT(SECONDS FROM (date_closed - created_date))