Joins between General Ledger and Sub Ledger Accounting

Joins between General Ledger and Sub Ledger Accounting, AskHareesh

Joins between GL(General Leder) and SLA(Sub ledger Accounting) in R12

ap_invoices_all
SELECT * FROM ap_invoices_all WHERE invoice_num = 'ERS-9163-109073'
--invoice_id=145054

xla_transaction_entities
SELECT * FROM xla.xla_transaction_entities WHERE source_id_int_1 = 145054
--entity_id=437892

xla_events
SELECT * FROM xla_events WHERE entity_id=437892
--event_id=171848

xla_ae_headers
SELECT * FROM xla_ae_headers WHERE event_id=171848
--ae_header_id=1576424,1576425

xla_ae_lines
SELECT gl_sl_link_id FROM xla_ae_lines WHERE ae_header_id IN (1576424,1576425)
 --gl_sl_link_id is obtained

gl_import_references
SELECT * FROM gl_import_references
WHERE gl_sl_link_id IN (SELECT gl_sl_link_id
     FROM xla_ae_lines
WHERE ae_header_id IN (1576424,1576425))

gl_je_batches
SELECT * FROM gl_je_batches 
WHERE je_batch_id IN (SELECT je_batch_id
     FROM gl_import_references
 WHERE gl_sl_link_id IN (SELECT gl_sl_link_id
     FROM xla_ae_lines
 WHERE ae_header_id IN (1576424,1576425)))

gl_je_headers
SELECT * FROM gl_je_headers
WHERE je_header_id IN (SELECT je_header_id
      FROM gl_import_references
  WHERE gl_sl_link_id IN (SELECT gl_sl_link_id
      FROM xla_ae_lines
  WHERE ae_header_id IN (1576424,1576425)))

gl_je_lines
SELECT * FROM gl_je_lines
WHERE je_header_id IN (SELECT je_header_id
      FROM gl_import_references
  WHERE gl_sl_link_id IN (SELECT gl_sl_link_id
      FROM xla_ae_lines
  WHERE ae_header_id IN (1576424,1576425)))


Also read: General Ledger Definition

*/