17,377
社区成员
发帖
与我相关
我的任务
分享
SITEID JZ KJ_NUMBERS
20100 #5机组 7
20100 #1机组 9
20100 #6机组 13
20100 #2机组 19
20100 #3机组 10
SITEID JZ TJ_NUMBERS
20100 #5机组 7
20100 #1机组 9
20100 #2机组 19
20100 #3机组 9
20100 #6机组 14
select kj.siteid,kj.jz,kj.kj_numbers,tj.tj_numbers from
(select siteid,jz,count(jbl) kj_numbers from runlognote where jbl in('开机') and dotedate2 between to_date('2010-1-10','yyyy-mm-dd') and to_date('2012-2-12','yyyy-mm-dd')
group by siteid,jz) kj,
(select siteid,jz,count(jbl) tj_numbers from runlognote where jbl in('停机') and dotedate2 between to_date('2010-1-10','yyyy-mm-dd') and to_date('2012-2-12','yyyy-mm-dd')
group by siteid,jz ) tj where kj.siteid=tj.siteid and kj.jz=tj.jz
select t1.SITEID 站点,
t1.JZ 机组,
t1.KJ_NUMBERS 开机次数,
t2.TJ_NUMBERS 停机次数
from t1 ,t2
where t1.SITEID=t2.SITEID
and t1.JZ=t2.JZ