墓型价格分析表

 SELECT t1.azfsmc AS AZFS,
            MIN (TO_CHAR (t1.rq, 'yyyy')) AS nd,
            t1.mxmc,
            t1.mj,
            MIN (t1.ssje) AS zx,
            MAX (t1.ssje) AS zd,
            TRUNC (AVG (t1.ssje), 2) AS pjz,
            COUNT (*) AS sl,
            SUM ((SELECT SUM (ssje)
                      FROM ywdjb
                     WHERE zxflag <> '1')
                 - (SELECT SUM (ssje)
                      FROM ywdjb
                     WHERE zxflag = '2'))
               AS sr,
         (SELECT LYID FROM lyxxb) AS DWDM
       FROM ywdjb t1, azfs t2
      WHERE     t1.azfsdm = t2.azfsdm
            AND (t2.stazbz = '1' OR t2.ltazbz = '1')
            AND t1.zxflag <> '1'
   GROUP BY t1.azfsmc,
            t2.nx,
            t1.mxmc,
            t1.mj;

 

posted @ 2016-06-29 15:48  韩梦芫  阅读(168)  评论(0编辑  收藏  举报