I need to be able to return the most recent event of a occurrence that may or may not have occurred more than once. For instance:
Each time a product is moved from position A to Position B, it is recorded (From_Function) / (To_Function) along with its operator and timestamp. On rare occasions, re-work is required, and that unit will show the same from / To instance with different timestamps.
I am currently calculating age in each position with a datediff, how do I return only the most recent in this scenario?
I got it down to if there is no group by clause it will return the date needed with a max(route_date_time); however, the total qry is many lines long with aggregate functions so a group by is necessary. How can I return only the one line that is needed with the most recent date?