1
After executing this query:
SELECT
p.name as nomerecebe,
r.created_at as datarecebimento,
r.original_amount as valorboleto,
rs.name as statusr,
SUM(r.original_amount) as total
FROM
people as p,
receipts as r,
receipt_status as rs
WHERE
p.id = r.person_id AND r.id = rs.id AND
r.created_at < CURRENT_DATE AND r.created_at > CURRENT_DATE -199
GROUP BY
nomerecebe, datarecebimento, valorboleto, statusr, total
I get this error message:
ERROR: aggregate functions are not allowed in GROUP BY LINE 6: SUM(r.original_amount) as total ^ ********** Error ********** ERROR: aggregate functions are not allowed in GROUP BY SQL state: 42803 Character: 129