SELECT * from tbl_loan WHERE RecordTime IN (select Max(RecordTime) from tbl_loan WHERE UserId = 2 Group By LoanId);