Skip to content
Advertisement

Create calculated field from MIN() and MAX() values of another column, grouped by unique ID

I have a table that looks like this, containing information about an object’s position and the length of time it existed for (age):

And I am trying to select the x position of a certain ID, when the age is at its minimum value for that ID (column named xStart), and when it is at its maximum value (column named xFin). IDs represent a different object on each day, so ID 20 on the 25th will not be the same object as ID 20 on the 26th.

I would like the resulting table to look something like this:

And that table could be grouped for each ID:

Advertisement

Answer

You can use window functions, if I understand:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement