SELECT * FROM (SELECT DISTINCT`lettings_ledger`.`ledgerID`, `lettings_ledger`.`transactionID`, `lettings_ledger`.`activityID`, `lettings_ledger`.`transactionType`,`lettings_ledger`.`propertyID`,`lettings_ledger`.`tenancyID`, `lettings_ledger`.`ledgerType`,`lettings_ledger`.`itemDescription`, `lettings_ledger`.`debitAmount`, `lettings_ledger`.`creditAmount`, `lettings_ledger`.`documentType`, `lettings_ledger`.`documentNumber`, `lettings_ledger`.`statementNumber`, `lettings_ledger`.`dateCreated`, `lettings_ledger`.`linkTable`, `lettings_ledger`.`linkField`,`lettings_ledger`.`linkID`, `lettings_statement`.`propertyStatementNumber`, `user`.`displayName`,`property`.`addressName`,`property`.`addressNumber`, `property`.`addressStreet`, `property`.`address2`, `property`.`address3`, `property`.`address4`, `property`.`addressPostcode`  FROM `lettings_ledger` INNER JOIN `user` ON `user`.`userID` = `lettings_ledger`.`recordCreatedBy` LEFT JOIN `property` ON `property`.`propertyID` = `lettings_ledger`.`propertyID` LEFT JOIN `lettings_statement` ON `lettings_ledger`.`statementNumber` = `lettings_statement`.`statementNumber` WHERE `lettings_ledger`.`ledgerType` = 'tenant' AND `lettings_ledger`.`tenancyID` = '4679' ORDER BY `lettings_ledger`.`dateCreated` DESC, `lettings_ledger`.`ledgerID` DESC, `lettings_ledger`.`activityID` DESC, `lettings_ledger`.`transactionID` DESC LIMIT 5) AS `test` ORDER BY `dateCreated`, `activityID`, `transactionID`

+----+-------------+--------------------+--------+---------------------+-----------------+---------+---------------------------------+------+----------+----------------------------------------------------------------------------+
| id | select_type | table              | type   | possible_keys       | key             | key_len | ref                             | rows | filtered | extra                                                                      |
+----+-------------+--------------------+--------+---------------------+-----------------+---------+---------------------------------+------+----------+----------------------------------------------------------------------------+
|  2 | DERIVED     | lettings_ledger    | ref    | tenancyID,idx_lt_sn | tenancyID       | 4       | const                           | 42   | 100.00   | Using where; Using temporary; Using filesort                               |
|  2 | DERIVED     | user               | eq_ref | PRIMARY             | PRIMARY         | 4       | lettings_ledger.recordCreatedBy | 1    | 100.00   | Using where; Using join buffer (flat, BKAH join); Key-ordered scan         |
|  2 | DERIVED     | property           | eq_ref | PRIMARY             | PRIMARY         | 4       | lettings_ledger.propertyID      | 1    | 100.00   | Using join buffer (incremental, BKAH join); Key-ordered scan               |
|  2 | DERIVED     | lettings_statement | ref    | statementNumber     | statementNumber | 4       | lettings_ledger.statementNumber | 1    | 100.00   | Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan |
+----+-------------+--------------------+--------+---------------------+-----------------+---------+---------------------------------+------+----------+-----------------------------
