I am trying to fetch count of all distinct values in particular column for example I have following table in model name MyModel :
Id City vendor
1 Mumbai 2
2 Pune 3
3 Mumbai 1
4 Yavatmal 2
5 Pune 5
I am looking for output something like this:
[{'Mumbai':2},{'Pune':2},{'Yavatmal':1}]
order_by
, as done answer in the duplicate. Without itthe count
is just equal to1
for everything. – Adama