Nov15

Using WITH in SQL

  WITH +conn AS ( SELECT zppt9401~rstmno

                    FROM zppt9401

                   INNER JOIN zppt9404

                      ON zppt9401~trcid = zppt9404~trcid

                   WHERE zppt9404~aufnr = @lv_aufnr )

       SELECT FROM +conn INNER JOIN zppt9405

              ON +conn~rstmno = zppt9405~rstmno

              FIELDS SUM( zppt9405~trcnum ) AS tsum

              INTO @lv_tsum.

a001.png

本篇文章已有0条评论