I have this sql query:
SELECT
`t1`.*, `t2`.*
FROM
`t1`,
LEFT JOIN `t2`.`t1_id` = `t1`.`id`
WHERE
`t2`.`id` = (
SELECT `internal`.`id`
FROM `t2` as `internal`
WHERE `internal`.`t1_id`=`t`.`id`
ORDER BY `internal`.`time` DESC LIMIT 1
)
This query selects t1 records along with the columns of the latest sing t2 record that is a child of t1.
I've had some failed attempts at eliminating the subquery and replacing it with joins.
Anyone has some insight into this?