In MariaDB / MySQL I have a table like this:
table (key1, key2, date)
with INDEX(key1, key2)
Now I want to take the oldest entry:
SELECT * FROM `table` ORDER BY `date` ASC LIMIT 1
And finally all entries matching key1
and key2
from the first query:
SELECT * FROM `table` WHERE `key1` = ? AND `key2` = ?
Can this be simplified into one query somehow?