SELECT django_datetime_cast_date(“apotheken_printout”.“date_printed”, ‘Europe/Berlin’, ‘UTC’), COUNT(“apotheken_printout”.“id”) AS “count” FROM “apotheken_printout” INNER JOIN “apotheken_apotheken” ON (“apotheken_printout”.“apotheke_id” = “apotheken_apotheken”.“id”) WHERE “apotheken_printout”.“apotheke_id” = 11 GROUP BY django_datetime_cast_date(“apotheken_printout”.“date_printed”, ‘Europe/Berlin’, ‘UTC’), “apotheken_apotheken”.“name”, “apotheken_printout”.“date_printed”
You’re welcome, I’ve ran into this exact issue more than a few times myself.
Checking the raw SQL was a good idea: it’s the “apotheken_apotheken”.“name” in the GROUP BY clause that gave it away for me (though it’s hard to spot in the middle of all that auto-generated goodness )