Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Friends
I have the following problem:
Pair | Arrival | Stage | Departure |
1 | 02/11/2021 13:31:27 | 1. Process | 02/11/2021 14:11:38 |
1 | 02/11/2021 14:12:02 | 1. Process | 02/11/2021 14:12:03 |
1 | 02/11/2021 14:18:27 | 2 Distribucion | 02/11/2021 14:18:28 |
2 | 02/11/2021 14:50:42 | 1. Process | 02/11/2021 15:03:51 |
2 | 02/11/2021 15:10:41 | 2 Distribucion | 02/11/2021 15:10:42 |
I have some pairs of data, but I would like to get the max and minimum, for example for the case of 1. Process would be the first Arrival that is, 11/02/2021 13:31:27 with the pair 1 Max Arrival (2 Distribution)
in the end they should look like this:
Pair | Arrival | Stage | Departure |
1 | 02/11/2021 13:31:27 | 1. Process | 02/11/2021 14:11:38 |
1 | 02/11/2021 14:18:27 | 2 Distribucion | 02/11/2021 14:18:28 |
2 | 02/11/2021 14:50:42 | 1. Process | 02/11/2021 15:03:51 |
2 | 02/11/2021 15:10:41 | 2 Distribucion | 02/11/2021 15:10:42 |
Thanks a lot
If the dates are strings rather than actual dates, you can use MinString and MaxString. If the dates are actual dates and you are just looking at the format being changed to a number, you can use Date(Min()) and Date(Max()) to re-format as date.
It sounds like a simple group by with min and max, but your sample doesn't match the text description - the max of the Departure for the first row would be 02/11/2021 14:12:03 in that case. If that's an error, it should be just a case of
Load Pair, Stage, Min(Arrival) as Arrival, Max(Departure) as Departure
From YourTable
Group By Pair, Stage;
Thanks it worked but, the dates are lost when doing the max and min
However I will try to fix it ...
Thanks a lot
If the dates are strings rather than actual dates, you can use MinString and MaxString. If the dates are actual dates and you are just looking at the format being changed to a number, you can use Date(Min()) and Date(Max()) to re-format as date.