新手上路,求助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 
 SELE