Under what circumstances would these 3 queries return different number of results? Hello I have the following question:
Query 1:

SELECT b.id,
    (
    SELECT SUM(cb.invoice_amount) AS sum
    FROM payment_lines cb
    WHERE cb.batch_id = b.id
    ) AS batch_total_invoice_amount
FROM batches b;


Query 2:

SELECT b.id, SUM(cb.invoice_amount) 
FROM batches b 
 LEFT JOIN payment_lines cb ON b.id = cb.batch_id 
GROUP BY b.id
ORDR BY b.id desc;


Query 3:


SELECT batch_id, sum(invoice_amount) 
FROM payment_lines
GROUP BY batch_id
ORDER BY batch_id desc;
The first query may return rows from batches where no payment-lines exist, ie. an outer join.