Let's say I have query set A.
A.annotate(c=Count(Case(When(name='Jack',then=I)
Now, each time A.name == 'Jack'
, c
will be set to I. How can I increment I for each time this happens? So that for the first case, I = 1
, for the 2nd I=2
etc.
Let's say I have query set A.
A.annotate(c=Count(Case(When(name='Jack',then=I)
Now, each time A.name == 'Jack'
, c
will be set to I. How can I increment I for each time this happens? So that for the first case, I = 1
, for the 2nd I=2
etc.