有人能优化这个mysql查询吗?
SELECT submittedform.*, inspectors.first_name, inspectors.last_name
FROM (
SELECT `dinsp`,`departure`,`arrival`,'cabin' as type FROM cabinets
UNION
SELECT `dinsp`,`departure`,`arrival`,'cockpit' as type FROM cockpits
ORDER BY `date_of_inspection` ASC
) AS submittedform
INNER JOIN inspectors ON inspectors.id = submittedform.dinsp
我不想依赖嵌套查询,这种情况下可以吗?此外,请为我提供一个CakePHP解决方案,但是这些表不能相关联。