COQL order by COUNT not working
Dear community,
I am trying to get a list of deal amounts per planner working on it and sorted to get see who has the least amount of deals.
For some reason, I am unable to use sort by in combination with a COUNT.
My original code was:
- query = "select COUNT(id) as 'Anzahl', Technischer_Planer as 'Planer' from Deals where (Stage in ('KVA erstellen', 'KVA Änderung') and Technischer_Planer in (select id from users where Team='TI - Technischer Innendienst' and Stufe='Aktiv')) group by Technischer_Planer order by 'Anzahl' asc";
This returns the error
- {"code":"INVALID_QUERY","details":{"column_name":"COUNT(id)"},"message":"column given seems to be invalid","status":"error"}
I have also tested
and
- ...order by COUNT(id) asc";
with both alternatives also returning errors. I am lost. What do I have to change to make it work?