i would like to return a single tuple with, field by field, the most frequent values. My models is as follows:
class myTable(models.Model):
a = models.IntegerField(blank = True, default = 0)
b = models.IntegerField(blank = True, default = 0)
c = models.IntegerField(blank = True, default = 0)
d = models.IntegerField(blank = True, default = 0)
My DB is as follows:
| ID | a | b | c | d |
|---|---|---|---|---|
| 0 | 2 | 4 | 1 | 0 |
| 1 | 3 | 4 | 2 | 3 |
| 2 | 2 | 3 | 1 | 3 |
| 3 | 1 | 2 | 6 | 2 |
The single tuple that I want to return is constitued like that: a=2, b=4, c=1, d=3 (a is 2,3,2 and 1 so the most frequent value is 2). How can I do that?