I want to find the most recent edit date for tables in my database.
This is an example of the query I plan to use:
SELECT `edited` FROM `table1`
UNION SELECT `edited` FROM `table2`
UNION SELECT `edited` FROM `table3`
UNION SELECT `edited` FROM `table4`
ORDER BY `edited` DESC
LIMIT 1
It works, but I am hoping someone can provide a more performant solution.
This may run faster as it will limit each of the selects to one row instead of returning all rows from each table.