Postgresql – Multi Join Table, Multiple Sums
I've got 3 tables I need to work with: CREATE TABLE invoices ( id INTEGER, number VARCHAR(256) ) CREATE TABLE items ( invoice_id INTEGER, total DECIMAL ) CREATE TABLE payments ( invoice_id INTEGER, total DECIMAL ) I need a result…