Sample Header Ad - 728x90

How to subtract from the current timestamp the number of hours stored in a column?

0 votes
1 answer
2000 views
I am trying to retrieve data from a column with integer values by getting the difference between the current_timestamp and the values in the column. This works in DB2 by simply stating the value as hour TRANS_DATETIME > (CURRENT_TIMESTAMP - my_column_alias HOURS). However using the same line in PostgreSQL returns the error below. Any ideas on how to modify query for PostgreSQL? > SQL Error : ERROR: operator does not exist: timestamp with time zone - integer¶ > Hint: No operator matches the given name and argument types. You might need to add explicit type casts.¶
Asked by kunleoju (3 rep)
Nov 21, 2022, 07:43 AM
Last activity: Nov 21, 2022, 07:00 PM