Showing
1 changed file
with
8 additions
and
0 deletions
doc/SQL/zj/V1202_1告警概览优化临时告警表sql.txt
0 → 100644
1 | +-- 添加告警临时表的唯一索引 列有资源id、时间 | ||
2 | +ALTER TABLE `b_alarm_trend_temporary` ADD CONSTRAINT unique_resId_and_createTime UNIQUE(resId,createTime); | ||
3 | + | ||
4 | +-- 删除告警临时表重复数据的 | ||
5 | +delete from b_alarm_trend_temporary where id not in (select id from (select count(1) as number,id,createTime,resId from b_alarm_trend_temporary group by createTime,resId having number=1) as c); | ||
6 | + | ||
7 | +--查询告警临时表又没重复数据 | ||
8 | +select count(1) as number,id,createTime,resId from b_alarm_trend_temporary group by createTime,resId having number>1; |
-
Please register or login to post a comment