创建数据表语句
![](https://images2015.cnblogs.com/blog/731047/201612/731047-20161206165628804-1331839037.png)
![](https://images2015.cnblogs.com/blog/731047/201612/731047-20161206165629194-506200560.png)
数据表数据
![](https://images2015.cnblogs.com/blog/731047/201612/731047-20161206165629679-188152680.png)
对上述数据进行TopN排名
![](https://images2015.cnblogs.com/blog/731047/201612/731047-20161206165630085-315034073.png)
select severity,sum(count) as sum from widgt_23 where insertTstamp>='2016-12-05 17:40:00' and insertTstamp<='2016-12-05 18:00:00' group by binary(severity) order by sum desc limit 10;
获取趋势图数据
![](https://images2015.cnblogs.com/blog/731047/201612/731047-20161206165630726-482868279.png)
select * from widgt_23 where insertTstamp>='2016-12-05 17:40:00' and insertTstamp<='2016-12-05 18:00:00' and severity=binary('Info') ;
转载请标明出处:http://www.cnblogs.com/ssslinppp/