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

关于分析函数(急求sql)
这个sql能用分析函数改写     或者优化不     太慢了


select   SUM(DECODE(a.summary_acct_item_id,   '100000 ',   a.CHARGE,   ' '))   CHARGE100000,
              SUM(DECODE(a.summary_acct_item_id,   '100001 ',   a.CHARGE,   ' '))   CHARGE100001,
              SUM(DECODE(a.summary_acct_item_id,   '100002 ',   a.CHARGE,   ' '))   CHARGE100002,
              SUM(DECODE(a.summary_acct_item_id,   '100003 ',   a.CHARGE,   ' '))   CHARGE100003,
              SUM(DECODE(a.summary_acct_item_id,   '100004 ',   a.CHARGE,   ' '))   CHARGE100004,
              SUM(DECODE(a.summary_acct_item_id,   '100005 ',   a.CHARGE,   ' '))   CHARGE100005,
              SUM(DECODE(a.summary_acct_item_id,   '100006 ',   a.CHARGE,   ' '))   CHARGE100006,
              SUM(DECODE(a.summary_acct_item_id,   '100007 ',   a.CHARGE,   ' '))   CHARGE100007,
              SUM(DECODE(a.summary_acct_item_id,   '100008 ',   a.CHARGE,   ' '))   CHARGE100008,
              SUM(DECODE(a.summary_acct_item_id,   '100009 ',   a.CHARGE,   ' '))   CHARGE100009,
              SUM(DECODE(a.summary_acct_item_id,   '100010 ',   a.CHARGE,   ' '))   CHARGE100010,
              SUM(DECODE(a.summary_acct_item_id,   '100011 ',   a.CHARGE,   ' '))   CHARGE100011,
              SUM(DECODE(a.summary_acct_item_id,   '100012 ',   a.CHARGE,   ' '))   CHARGE100012,
              SUM(DECODE(a.summary_acct_item_id,   '100013 ',   a.CHARGE,   ' '))   CHARGE100013,
              SUM(DECODE(a.summary_acct_item_id,   '100014 ',   a.CHARGE,   ' '))   CHARGE100014,
              SUM(DECODE(a.summary_acct_item_id,   '100015 ',   a.CHARGE,   ' '))   CHARGE100015,
              SUM(DECODE(a.summary_acct_item_id,   '100016 ',   a.CHARGE,   ' '))   CHARGE100016,
              SUM(DECODE(a.summary_acct_item_id,   '100017 ',   a.CHARGE,   ' '))   CHARGE100017,
              SUM(DECODE(a.summary_acct_item_id,   '100018 ',   a.CHARGE,   ' '))   CHARGE100018,
              SUM(DECODE(a.summary_acct_item_id,   '100019 ',   a.CHARGE,   ' '))   CHARGE100019,
              SUM(DECODE(a.summary_acct_item_id,   '100020 ',   a.CHARGE,   ' '))   CHARGE100020,
              SUM(DE