1
I have this select:
select
DISTINCT (clients.name) as nomeempresa,
payments.amount_paid as pagamento,
receipts.original_amount as recebimento
FROM
payments,
receipts,
receipt_status,
payment_status,
clients
WHERE
payments.id = payment_status.id AND
receipts.id = receipt_status.id AND
clients.id = payments.client_id AND
clients.id = receipts.client_id AND
payments.created_at < CURRENT_DATE AND payments.created_at > CURRENT_DATE-1 OR
receipts.created_at < CURRENT_DATE AND receipts.created_at > CURRENT_DATE-1
GROUP BY
nomeempresa, pagamento, recebimento
I have to filter the output and show the total in the next column.
SUM( receipts.original_amount) and removes recipes it from group by
– Caique Romero