📜  按最大日期分组 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:15.200000             🧑  作者: Mango

代码示例1
SELECT train, dest, time FROM ( 
  SELECT train, dest, time, 
    RANK() OVER (PARTITION BY train ORDER BY time DESC) dest_rank
    FROM traintable
  ) where dest_rank = 1