Is it possible to write a PostgreSQL query that gives time differences based on other record data?
That is, I have something like:
ID | CAT | Realtime | Value
---+-----+------------+------
A | 1 | timestamp1 | 10
A | 1 | timestamp2 | 15
A | 2 | timestamp1 | 2
A | 2 | timestamp2 | 55
B | 1 | timestamp1 | 5
B | 1 | timestamp2 | 10
And I’d like to add a field that finds the difference between timestamp 2 – timestamp1 based on identifiers ID AND CAT.
I’m not entirely sure what you’re asking, but is this what you’re looking for?