日期:2014-05-17 浏览次数:20804 次
SELECT Q.NAME DEVICE_NAME,T.NAME T_NAME,B.AVE,B.SD,
SUM(DECODE(D.OUT_OF_CONTROL,1,1,0)) OUT_OF_CONTROL_TIME,
COUNT(D.ID)TEST_TIME,
D.TEST_ID,B.Batch_No,
POWER(AVG(DECODE(D.ISCALPOINT,0,POWER(D.TEST_VAL-AVG(DECODE(NVL(D.ISCALPOINT,0),0,D.TEST_VAL,NULL))),2))),0.5),
AVG(DECODE(NVL(D.ISCALPOINT,0),0,D.TEST_VAL,NULL)) SSS
FROM QC_QCTEST_DATA D,QC_TEST T,QC_DEVICE Q,QC_QCTEST_BATCH B
WHERE D.DEV_ID=1715
--AND TO_CHAR(D.TEST_DATE_TIME,'yyyy-MM')='2013-05'
AND D.TEST_DATE_TIME >= TO_DATE('2013-05','YYYY-MM')
and D.TEST_DATE_TIME < ADD_MONTHS(TO_DATE('2013-05','YYYY-MM'),1)
AND B.TYPE=2
AND D.BATCH_ID=B.ID
AND D.DEV_ID=Q.ID
AND D.TEST_ID=T.ID
GROUP BY D.TEST_ID,Q.NAME,T.NAME,B.AVE,B.SD,B.TYPE,B.Batch_No