0 Replies Latest reply: Jun 25, 2013 4:35 AM by c016b064-8102-47b1-9d5b-076001b28670 RSS

    combine two set of queries

    c016b064-8102-47b1-9d5b-076001b28670

      Hi,Please can any one help me how to combine the following two queries...

       

      Query 1

       

      SELECT distinct GCC.segment1,GCC.segment2,GCC.segment3,GCC.segment4,GCC.segment5,

      GCC.segment6, DECODE(gcc.segment6,NULL,'',SUBSTR(apps.gl_flexfields_pkg.get_description_sql( gcc.chart_of_accounts_id,6,gcc.segment6),1,40))

      DETAILS, sum(gje.accounted_dr) BUDGET_2014

      FROM  gl_je_lines gje, gl_code_combinations gcc

      WHERE gje.code_combination_id(+)=gcc.code_combination_id

      and je_header_id in (select je_header_id from gl_je_headers  where

      BUDGET_VERSION_ID in (select Bv.budget_version_id from gl_budget_versions Bv , gl_balances bal  where BUDGET_NAME = 'BUDGET 2014_2' and actual_flag= 'B'))

      and gcc.segment3 between 3100000000 and 3199999999 and gcc.segment2 =31

      group by GCC.segment1,GCC.segment2,GCC.segment3,GCC.segment4,GCC.segment5,

      GCC.segment6, DECODE(gcc.segment6,NULL,'',SUBSTR(apps.gl_flexfields_pkg.get_description_sql

      (gcc.chart_of_accounts_id,6,gcc.segment6),1,40))

       

      Query 2


      SELECT distinct GCC.segment1,GCC.segment2,GCC.segment3,GCC.segment4,GCC.segment5,

      GCC.segment6, DECODE(gcc.segment6,NULL,'',SUBSTR(apps.gl_flexfields_pkg.get_description_sql( gcc.chart_of_accounts_id,6,gcc.segment6),1,40))

      DETAILS,sum(gje.accounted_dr) BUDGET_2011

      FROM  gl_je_lines gje, gl_code_combinations gcc

      WHERE gje.code_combination_id(+)=gcc.code_combination_id

      and je_header_id in (select je_header_id from gl_je_headers  where

      BUDGET_VERSION_ID in (select Bv.budget_version_id from gl_budget_versions Bv , gl_balances bal  where BUDGET_NAME = '2011 BUDGET' and actual_flag= 'B'))

      and gcc.segment3 between 3100000000 and 3199999999 and gcc.segment2 =31

      group by GCC.segment1,GCC.segment2,GCC.segment3,GCC.segment4,GCC.segment5,

      GCC.segment6, DECODE(gcc.segment6,NULL,'',SUBSTR(apps.gl_flexfields_pkg.get_description_sql

      (gcc.chart_of_accounts_id,6,gcc.segment6),1,40))