SyntaxFix
Write A Post
Hire A Developer
Questions
As long as there are no duplicates (and trains tend to only arrive at one station at a time)...
select Train, MAX(Time), max(Dest) keep (DENSE_RANK LAST ORDER BY Time) max_keep from TrainTable GROUP BY Train;