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)
博客展示了两条SQL查询语句。一是查找最大值,通过联合表A和表B中[alertMark]为1的timeAlert列数据,再从中选取最大值;二是统计总数,分别统计表A和表B中[alertMark]为1的记录数并相加。
410

被折叠的 条评论
为什么被折叠?



