I am struggling with an SQL time comparison on two fields that have been set up as integers, rather than time stamps.
I have some performance metrics in a database that the developer originally set up as int(8). The database contains the start and end times of a transaction. For example
Some sample data may be
id | start_time | end_time
---------------------------
1 | 85958 | 90001
If I simply subtracted the two values, I would get 4043 seconds, when the transaction time is only 3. I am struggling however to convert the values into a time format that allows me to perform date comparisons.
I am unable to do this calculation within the application, because there are 100's of rows in the database per day, and I am trying to calculate the average and max times for the transactions.
EDIT:
To clarify
The times are in seconds 85958 represent 8:59:58 90001 represents 9:00:01
To make things worse, 1 minute past midnight 0:01:00 would be represented as 100.