rendered paste bodymysql> EXPLAIN SELECT root.messageid, IFNULL(( SELECT MAX(reply.senttime) FROM zeroseventwo_forummessages reply WHERE reply.thread = 2 AND reply.touid = root.messageid), root.senttime) as lasttime, root.thread FROM zeroseventwo_forummessages root WHERE root.thread = 1 ORDER BY lasttime DESC;
+----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+
| 1 | PRIMARY | root | ref | thread | thread | 2 | const | 80 | Using where; Using filesort |
| 2 | DEPENDENT SUBQUERY | reply | ref | thread,touid | touid | 5 | phpdip.root.messageid | 4 | Using where |
+----+--------------------+-------+------+---------------+--------+---------+-----------------------+------+-----------------------------+
2 rows in set (0.00 sec)