新手上路,求助SQL循环
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=1 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=1 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=1 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=1 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=2 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=2 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=2 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=2 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=3 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=3 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=3 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=3 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=4 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=4 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=4 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=4 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=5 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=5 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=5 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=5 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=6 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=6 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=6 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=6 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=7 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=7 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=7 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=7 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=8 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=8 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=8 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=8 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=9 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=9 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=9 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=9 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=10 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=10 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=10 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=10 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=11 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=11 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=11 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=11 and iAlarmType=3
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=12 and iAlarmType=0
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=12 and iAlarmType=1
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=12 and iAlarmType=2
SELECT count(*) FROM tbl_AlarmHistory where year(iResTime)=2006 and month(iResTime)=12 and iAlarmType=3
上面是查询2006年1-12月告警类型分别为0.1.2.3的条数,哪位大虾帮忙能写的简单点吗?我用的是死办法,写了48条语句,小弟在此先谢谢了!