日期:2014-05-17  浏览次数:20705 次

語句優化!
SELECT       b.wo_no,   b.part_no,   c.process,   e.route_code   input,
                  e1.route_code   output,   SUM   (a.qty)   inputqty,d.outputqty,
                  TO_CHAR   (NVL   (TRUNC   (d.outputqty   /   SUM   (a.qty),   2)   *   100,   0)   ||   '% ')   output_rate,
                        SUM   (a.qty)   -   d.outputqty   wip,
                  g.meaning   org
        FROM   sfcs.sfcs_io_statistics   a,
                  sfcs.wip_wo   b,
                  sfcs.inv_pn_process   c,
                  sfcs.sh_route_code   e,
                  sfcs.sh_route_code   e1,
                  sfcs.inv_pn   f,
                  sfcs.sys_parameters   g,
                  (SELECT       SUM   (a1.qty)   outputqty,   b1.wo_no,   b1.part_no,   c1.process
                          FROM   sfcs.sfcs_io_statistics   a1,
                                      sfcs.wip_wo   b1,
                                    sfcs.inv_pn_process   c1
                          WHERE   a1.route_code   =   c1.o_ws_id
                              AND   a1.TYPE   =   'O '
                              AND   a1.wo_key   =   b1.wo_key
                              AND   c1.part_no   =   b1.part_no
                              AND   a1.part_no   =   c1.part_no
                    GROUP   BY   b1.wo_no,   b1.part_no,   c1.process)   d
      WHERE   a.route_code   =   c.i_ws_id
          AND   c.i_ws_id   =   e.routecode_key
          AND   c.o_ws_id   =   e1.routecode_key
          AND   a.TYPE   =   'I '
          AND   a.wo_key   =   b.wo_key
          AND   c.part_no   =   b.part_no
          AND   a.part_no   =   c.part_no
          AND