写的不对,要关联总账表,另外xla的表也不对
时间: 2024-02-24 07:58:22 浏览: 134
非常抱歉,我理解错了您的问题。以下是一个从总账追溯到资产的 SQL 查询脚本,其中包括了 XLA 表和总账表:
```
SELECT ga.accounting_date, ga.je_header_id, ga.je_line_num, ga.code_combination_id, a.asset_number, a.asset_description
FROM gl_je_lines gl, gl_import_references gir, xla_distribution_links xdl, xla_ae_lines xal, xla_ae_headers xah, fa_additions_b a, gl_import_references gir1, gl_je_lines ga
WHERE xdl.application_id = gl.application_id
AND xdl.source_distribution_type = 'GL_JE_LINES'
AND xdl.source_distribution_id = gl.je_line_id
AND xal.ae_header_id = xdl.event_id
AND ga.je_line_num = gir.je_line_number
AND ga.je_header_id = gir.je_header_id
AND gir.reference_type = 'ASSET_ID'
AND gir.reference_id = a.asset_id
AND ga.code_combination_id = gir1.code_combination_id
AND ga.je_header_id = gir1.je_header_id
AND gir1.reference_type = 'ASSET_COST_ADJ'
AND gir1.reference_id = a.asset_cost_adjustment_id
AND xah.ae_header_id = xal.ae_header_id
AND xah.application_id = xal.application_id
AND xah.accounting_entry_status_code = 'P'
AND ga.je_header_id = gl.je_header_id
AND ga.je_line_num = gl.je_line_num
AND ga.code_combination_id = gl.code_combination_id
AND ga.effective_date BETWEEN :p_start_date AND :p_end_date;
```
其中,`:p_start_date` 和 `:p_end_date` 是要查询的日期范围。此 SQL 脚本将返回与总账中资产相关的 JE 头、JE 行、科目、资产编号和资产描述。
希望这个 SQL 脚本能够帮到您。
阅读全文