SELECT aphd.*
FROM AP_PAYMENT_HIST_DISTS aphd,
AP_INVOICE_DISTRIBUTIONS_ALL aid,
AP_PAYMENT_HISTORY_ALL aph
WHERE aid.invoice_id = '166014'
AND aid.invoice_distribution_id = aphd.invoice_distribution_id
AND aph.payment_history_id = aphd.payment_history_id;