Wednesday, August 31, 2016

Query to Get the Oracle GL Balances

SELECT   (SELECT gcc.concatenated_segments
            FROM gl_code_combinations_kfv gcc
           WHERE gcc.code_combination_id = gjl.code_combination_id) code_combo,
         (SELECT gjs.user_je_source_name
            FROM gl_je_sources gjs
           WHERE gjs.je_source_name = gjh.je_source) je_source,
         (SELECT gjc.user_je_category_name
            FROM gl_je_categories gjc
           WHERE gjc.je_category_name = gjh.je_category) je_category,
         gjh.period_name, SUM (gjl.accounted_dr), SUM (gjl.accounted_cr)
    FROM gl_je_headers gjh, gl_je_lines gjl
   WHERE gjh.je_header_id = gjl.je_header_id
     AND gjh.status = 'P'
    -- AND gjh.je_source IN ('AutoCopy')
     AND gjh.je_category IN ('Receiving','Inventory','WIP','Purchase Invoices')
     AND gjh.actual_flag = 'A'
GROUP BY gjl.code_combination_id,
         gjh.je_source,
         gjh.je_category,
         gjh.period_name
ORDER BY gjl.code_combination_id,
         gjh.je_source,
         gjh.je_category,

         gjh.period_name;

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect