1、查找最大值
select max(timeAlert) from
(
select timeAlert from A where [alertMark]=1
union
select timeAlert from B where [alertMark]=1
) aa
2、统计总数
select
(select count(*) from A where [alertMark]=1)
+
(select count(*) from B where [alertMark]=1)