I have the following query:
SELECT
SUM(\"balance_transactions\".\"fee\") AS sum_id
FROM \"balance_transactions\"
JOIN charges ON balance_transactions
Well coming from a SQL Server background I would change your where clause to
...
AND (
"balance_transactions"."created" BETWEEN '2013-12-20' AND '2014-01-19'
OR
"balance_transactions"."created" BETWEEN '2013-12-21' AND '2014-01-20'
OR
"balance_transactions"."created" BETWEEN '2013-12-23' AND '2014-01-22'
OR
"balance_transactions"."created" BETWEEN '2013-12-24' AND '2014-01-23'
);
Just be sure you have a good index on those dates! :)