Hai bisogno di un alias per la sottoquery e devi applicare le condizioni a entrambe le query che unisci:
SELECT MAX(DateTime)
FROM (
SELECT DateTime
FROM Class_Searches
WHERE User_Email = '[email protected]'
AND DateTime > NOW( ) - INTERVAL 30 DAY
UNION ALL
SELECT DateTime
FROM Book_Searches
WHERE User_Email = '[email protected]'
AND DateTime > NOW( ) - INTERVAL 30 DAY
) AS x
o restituire i dati in modo da poter applicare la condizione nella query esterna:
SELECT MAX(DateTime)
FROM (
SELECT DateTime, User_Email
FROM Class_Searches
UNION ALL
SELECT DateTime, User_Email
FROM Book_Searches
) AS x
WHERE User_Email = '[email protected]'
AND DateTime > NOW( ) - INTERVAL 30 DAY