ROW_NUMBER() 関数 を使用します および PARTITION BY 句。このようなもの:
SELECT Id, Name, Date FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY Id ORDER BY Date desc) AS ROWNUM FROM [MyTable] ) x WHERE ROWNUM = 1
プレ>
ROW_NUMBER() 関数 を使用します および PARTITION BY 句。このようなもの:
SELECT Id, Name, Date FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY Id ORDER BY Date desc) AS ROWNUM FROM [MyTable] ) x WHERE ROWNUM = 1
プレ>