In Postgresql, I try to subtract 5 milliseconds
(using fixed constant, when I search on Google, most of example using fixed constants)
SELECT ([field start_date] - interval '00:00:00.005') AS work_timestamp
from mytable
How to change ‘5’ or ’00:00:00.005′ form query above
with a calculated process or from a field value
with a field value (field ms_value) :
SELECT ([field start_date] - interval '00:00:00.00'+[field ms_value]) AS work_timestamp
from mytable
with a calculated process (field ms_value1 and ms_value2 or other calculated process) :
SELECT ([field start_date] - interval '00:00:00.00'+[field ms_value1-field ms_value2]) AS work_timestamp
from mytable
Thank you
4
Answers
The solution I usual use is Concatenates the values with its unit, afterthat cast it to Interval.
i.e:
In your case will be
Just do a quick calculation:
Avoid concat. Multiply by a constant of 1 millisecond seems better
if 5 is provided externally
5 could potentially be (field ms_value1- field ms_value2) in your final example.
You can use make_interval()
Online example