Current location - Loan Platform Complete Network - Big data management - Database table A, B, C three fields, A is number, B is score, C is time, how to find out the latest score for each number in A? Use SELECT statement.
Database table A, B, C three fields, A is number, B is score, C is time, how to find out the latest score for each number in A? Use SELECT statement.
select a.* from table a, (select A, max(C) C from table) as b

where a.A=b.A and a.C=B.C

It is better to build an index on A, and C, or just build the primary key!

Speed should be very fast, the A and MAX (C) out of a separate temporary table, and then do the table connection, much faster than the use of sub-query, sub-query is every record has to make a sub-query, the overhead is too much, large amounts of data in general should not be used sub-query,