SELECT sum("public"."account_move_line"."credit") AS "sum", date_trunc('month', CAST("public"."account_move_line"."date" AS timestamp)) AS "date", "account_account__via__account_"."id" AS "id" FROM "public"."account_move_line" LEFT JOIN "public"."account_account" "account_account__via__account_" ON "public"."account_move_line"."account_id" = "account_account__via__account_"."id" WHERE "account_account__via__account_"."id" BETWEEN 623 AND 627 GROUP BY date_trunc('month', CAST("public"."account_move_line"."date" AS timestamp)), "account_account__via__account_"."id" ORDER BY date_trunc('month', CAST("public"."account_move_line"."date" AS timestamp)) ASC, "account_account__via__account_"."id" ASC