Expensive;
I have a table with a lot of information, including a field with ticket_value and one with maturity.
I tried the query below, but without success:
SELECT * FROM boleto WHERE extract(year_month from vencimento) = 201805, (SUM(-valor_boleto)+5000) AS valor_boleto FROM boleto";
The error generated is syntax from Sum.
If I just run the current month sorting, it works correctly:
SELECT * FROM boleto WHERE extract(year_month from vencimento) = 201805;
Where am I going wrong, or do you have a simpler way of doing this query?