Outer join for both tables

From: Alexey Karpenko <alexey_karpenko_at_a-n.kiev.ua>
Date: Sun, 19 Aug 2001 16:09:01 +0300
Message-ID: <998226588.30077_at_ipt2.iptelecom.net.ua>


Hi,

I have three tables: invoices, payments and invoice_payment. The first two store invoices and payments respectively and the last stores invoice_id, payment_id and the sum of this payment spent on this invoice. That is many-to-many relationship.
The question is how do I retrieve all sums in from invoice_payment as well as invoices and payments that are not bound through invoice_payment relationship?
If I needed only payments that are not in invoice_payment, I would use outer join on invoice_payment. It's the same if I needed only invoices that are not covered at all, but how do I get both payments and invoices?

I'm sure questions like mine are asked from time to time and are kind of FAQ, but I find it difficult to formalize the query for a search engine to get the right answer.

Any comments are welcome!

Thank you in advance,

    Alexey Karpenko Received on Sun Aug 19 2001 - 15:09:01 CEST

Original text of this message