一下午就是為了這一句SQL!
快累死了!
SELECT a.cnt_pass, DECODE (b.cnt_fail, NULL, 0, b.cnt_fail) cnt_fail,
e.lob_no, TO_CHAR (SYSDATE, 'YYYY-MM-DD ') today, a.line,
(a.cnt_pass + DECODE (b.cnt_fail, NULL, 0, b.cnt_fail)) total_cnt,
DECODE ( ROUND ((a.cnt_pass / (b.cnt_fail + a.cnt_pass)) * 100, 1)
|| '% ',
'% ', '100% ',
ROUND ((a.cnt_pass / (b.cnt_fail + a.cnt_pass)) * 100, 1)
|| '% '
) pass_yield,
DECODE (c.cnt_repair, NULL, 0, cnt_repair) cnt_repair,
DECODE (d.cnt_ng, NULL, 0, d.cnt_ng) cnt_ng,
DECODE (b.cnt_fail, NULL, 0, b.cnt_fail)
- ( DECODE (c.cnt_repair, NULL, 0, cnt_repair)
+ DECODE (d.cnt_ng, NULL, 0, d.cnt_ng)
) wait_repair,
DECODE (ROUND ( ( ( DECODE (c.cnt_repair, NULL, 0, cnt_repair)
+ DECODE (d.cnt_ng, NULL, 0, d.cnt_ng)
)
/ b.cnt_fail
)
&