Select Most Recent States From History Table

后端 未结 5 859
栀梦
栀梦 2021-02-08 13:27

I have inherited a table with a structure something like this:

ID   Name   Timestamp   Data
----------------------------
1    A      40          ...
2    A               


        
5条回答
  •  醉酒成梦
    2021-02-08 14:07

    Another easy way :

    SELECT ID,Name,Timestamp, Data
    FROM   Test_Most_Recent
    WHERE Timestamp = (SELECT MAX(Timestamp)
                     FROM Test_Most_Recent
                     group by Name);
    

提交回复
热议问题