Currently I have a table with the following values:
some-id timestamp
--------- -----------
1 12:45
1 12:50
2 3:13
2 3:15
3 11:33
3 11:50
I would like a resulting SELECT
to return the below:
some-id timestamp_a timestamp_b
--------- ------------- -------------
1 12:45 12:50
2 3:13 3:15
3 11:33 11:50
eg. The timestamp
is grouped by a duplicate some_id
Is this possible with SQL?
CodePudding user response:
This appears to be just a simple aggregation,
select some-id, Min(Timestamp) Timestamp_a, Max(Timestamp) Timestamp_b
from t
group by some-id