Tanpa melihat skema, saya merasa sulit tetapi ini seharusnya mengarahkan Anda ke arah yang benar:
FROM apps.po_requisition_lines_all prl
INNER JOIN apps.po_requisition_headers_all prha ON prl.requisition_header_id = prha.requisition_header_id
INNER JOIN po.po_req_distributions_all prda ON prda.requisition_line_id = prl.requisition_line_id
LEFT JOIN po.po_distributions_all pda ON prda.distribution_id = pda.req_distribution_id
-- I note from the example provided that this is a right join
-- Without seeing the schema, it looks to me as though it should be left
-- As I say say, without seeing the schema, I probably shouldn't pass comment
RIGHT JOIN po.po_headers_all pha ON pha.po_header_id = pda.po_header_id;
Untuk INNER JOIN
Anda cukup mengatakan JOIN
meskipun saya pikir itu secara eksplisit mengatakan INNER
membantu keterbacaan. Saya juga perhatikan contoh yang diberikan memiliki WHERE 1=1
yang berlebihan.