Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm loading some flight data that is being used for further calculations. However, some flights have multiple records , like in the table below.
Flight Number | flt_date | Dep | Arr | fob_ontime_kg | zfw | LatestTimeStamp |
777 | 2023-10-01 | ABC | XYZ | 7257.48 | 197561 | 10/1/2023 8:46:00 AM |
777 | 2023-10-01 | ABC | XYZ | 7257.48 | 197630 | 10/1/2023 8:23:00 AM |
777 | 2023-10-01 | ABC | XYZ | 7257.48 | 197649 | 10/1/2023 8:27:00 AM |
I want to load only the record with the latest timestamp. I'm using the code below. But this does not work; all records are being loaded regardless of the max time.
Hi,
try below
zfw is included within the group by and prevent the intended aggregation.