Postgresql – How can I select rows from a table where the sum of rows in a joined table is greater than a number?
I have a order table and a payment table where multiple payments are joined to an order. order id name 1 order 1 2 order 2 payment id order_id amount 1 1 2000 2 1 3000 3 2 500 4…