A: according to a sort field (time, total number, etc.), first obtain
SELECT A. * the FROM ( SELECT * from ( SELECT T. * , ROW_NUMBER () over (Partition by t.id Order by t.createtime desc ) RN from Table T ) C WHERE RN = . 1 ) A WHERE a.id = ' 001 ' ; - add the proviso that where a query, the query without a plurality of
Two: If it is time to get the latest piece of data
The SELECT * the FROM Table the WHERE (ID, CreateTime) the IN ( the SELECT ID, MAX (CreateTime) CreateTime the FROM Table the GROUP BY ID); - obtaining a plurality of data of the latest time the SELECT * the FROM Table WHERE a.id = ' 018 ' and CreateTime = ( the SELECT MAX (CreateTime) the FROM Table WHERE a.id = ' 018 ' ); - obtaining a time-date data