SELECT TOP 1 * FROM
(
select max(updatedtimestamp) from db1.dbo.policyrepresentationcache with(nolock)
UNION
select max(updatedtimestamp) from db2.dbo.policyrepresentationcache with(nolock)
)
ORDER BY updatedtimestamp
I'm running into syntax errors here and im not sure how to set it up.