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,